Dim qs As String = e.Form.Controls("起始号段").Text Dim js As String = e.Form.Controls("结束号段").Text Dim gs As String = e.Form.Controls("重复个数").Text Dim gd As String = e.Form.Controls("固定号段").Text Dim tg() As String = e.Form.Controls("跳过").Text.Split(",") Dim fmt As String = "".PadLeft(qs.length,"0") '根据起始数得出数字占位长短 If gs = "" Or gs = "0" Then MessageBox.show("请输入重复个数,无需重复请输入1","错误输入",MessageBoxButtons.OK,MessageBoxIcon.Error) Else Dim str As String Dim tgnum As String For i As Integer = qs To js For s As Integer = 1 To gs Dim temp As String If gd > "" AndAlso e.Form.Controls("CheckBox1").Checked = True Then temp = gd & Format(i,fmt) & vbcrlf Else If gd > "" AndAlso e.Form.Controls("CheckBox2").Checked = True Then temp = Format(i,fmt) & gd & vbcrlf Else temp = Format(i,fmt) & vbcrlf End If If array.Indexof(tg, i) = -1 AndAlso array.IndexOf(tg, Format(i,fmt)) = -1 Then str = str & temp End If Next Next Dim open As New SaveFileDialog open.Title = "保存号段" open.Filter = "文本文件|*.txt" open.OverwritePrompt = True If open.ShowDialog = DialogResult.OK Then FileSys.WriteAllText(open.FileName,str,False,Encoding.Unicode) End If End If
|