Foxtable(狐表)用户栏目专家坐堂 → 多分支条件问题,求解


  共有2156人关注过本帖平板打印复制链接

主题:多分支条件问题,求解

美女呀,离线,留言给我吧!
youkacard
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:269 积分:1847 威望:0 精华:0 注册:2014/11/9 21:57:00
多分支条件问题,求解  发帖心情 Post By:2015/5/29 10:53:00 [只看该作者]

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
图片点击可在新窗口打开查看


 回到顶部