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
Dim t5 As String = e.Form.Controls("TextBox5").Text
If t5 <> Nothing Then
tj = t5.Split(",") '条件输入
End If
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 t5 <> Nothing 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 t5 <> Nothing 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 t5 <> Nothing 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