Dim Result As String '储存生成结果
Dim Start As String = e.Form.Controls("TextBox1").Value '起始号码
Dim Number As String = e.Form.Controls("TextBox2").Value '生成数量
Dim nEnd As Integer = CInt(Start) + CInt(Number) - 1 '结束号码
Dim fmt As String = "".PadLeft(Start.Length,"0") '获取起始字符占位
Dim tj() As String = e.Form.Controls("TextBox5").Value.Split(",") '条件输入
Dim gds As String = e.Form.Controls("TextBox3").Value '获取固定首位字符
Dim gdw As String = e.Form.Controls("TextBox3").Value '获取固定尾部字符
For i As Integer = Start To nEnd
If e.Form.Controls("CheckBox1").Checked And tj.Length > 0 Then '尾数跳过条件成立
If Array.LastIndexOf(tj,CStr(i Mod 10)) = -1 Then
Result &= Format(i,fmt) & vbcrlf
End If
Else If e.Form.Controls("CheckBox2").Checked And tj.Length > 0 Then '全部跳过条件成立
Dim b As Boolean = True
For s As Integer = 0 To tj.Length - 1
If CStr(i).Contains(tj(s)) Or Format(i,fmt).Contains(tj(s)) Then
b = False
End If
Next
If b Then
Result &= Format(i,fmt) & vbcrlf
End If
Else If e.Form.Controls("CheckBox3").Checked And tj.Length > 0 Then '重复条件成立
For x As Integer = 1 To tj(0)
Result &= Format(i,fmt) & vbcrlf
Next
Else
Result &= Format(i,fmt) & vbcrlf
End If
Next
Dim save As New SaveFileDialog
save.Filter = "文本文件|*.txt"
save.Title = "保存数据"
save.OverwritePrompt = True
If save.ShowDialog = DialogResult.OK Then
FileSys.WriteAllText(save.FileName,Result,False,Encoding.Unicode)
End If
-----------------------------------------------------------------------分割线---------------------------------------------------------------------------
红色标注的那句代码,按照正常情况下,应该是前面三个条件不成立的情况下,执行这一局才对,可是执行的时候为什么报错呢?
报错情况如下:
此主题相关图片如下:qq截图20150529105233.jpg
