Foxtable(狐表)用户栏目专家坐堂 → 版主指点一下这段代码怎么写才能紧凑和正确?


  共有2480人关注过本帖树形打印复制链接

主题:版主指点一下这段代码怎么写才能紧凑和正确?

帅哥哟,离线,有人找我吗?
旭日生
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:340 积分:3375 威望:0 精华:0 注册:2011/3/22 22:52:00
版主指点一下这段代码怎么写才能紧凑和正确?  发帖心情 Post By:2017/8/31 13:30:00 [显示全部帖子]


图片点击可在新窗口打开查看此主题相关图片如下:目录问题.jpg
图片点击可在新窗口打开查看



     e.Form.controls("Table1").Table.addnew()
    e.Form.controls("Table2").Table.addnew()
    e.Form.controls("Table3").Table.addnew()
    e.Form.controls("Table4").Table.addnew()
    Dim ls1 As Row = e.Form.controls("Table1").Table.current
    Dim ls2 As Row = e.Form.controls("Table2").Table.current
    Dim ls3 As Row = e.Form.controls("Table3").Table.current
    Dim ls4 As Row = e.Form.controls("Table4").Table.current
    
    Dim txt1 As WinForm.TextBox = e.Form.Controls("TextBox1")
    Dim txt2 As WinForm.TextBox = e.Form.Controls("TextBox2")
    
    Dim txt3 As WinForm.TextBox = e.Form.Controls("TextBox3")
    Dim txt4 As WinForm.TextBox = e.Form.Controls("TextBox4")
    
    Dim txt5 As WinForm.TextBox = e.Form.Controls("TextBox5")
    Dim txt8 As WinForm.TextBox = e.Form.Controls("TextBox8")
    Dim WJH As Integer = val(txt1.text)
    Dim ND As String = txt8.text
    Dim lb As String = txt5.text
    
    Dim fdr As DataRow = DataTables("xls").find("AH like '%" & Format(wjh, "0000") & "%' and AH like '%" & nd & "%' and AH like '%" & lb & "%'")
    
    If fdr IsNot Nothing Then
        ls1("LSH") = fdr("LSH")
        ls2("LSH") = fdr("LSH")
        ls3("LSH") = fdr("LSH")
        ls4("LSH") = fdr("LSH")
    End If
    

’下面这段有结果,但存在问题。但我一下子找不到问题所在。
If e.KeyCode = 13 Then

For i As Integer = -2 To val(txt4.text)
    Select Case  i
        Case -2
            ls1("LSH") = fdr("LSH")
            ls1("JZLB") = txt2.text
            ls1("FILENAME") = "FM"  & ".jpg"
            ls1("PGTYPE") =  "1"
            
        Case -1
            e.Form.controls("Table1").Table.addnew()
            ls1("LSH") = fdr("LSH")
            ls1("FILENAME") = "ML"  & ".jpg"
            ls1("PGTYPE") = "2"
            ls1("JZLB") = txt2.text

            
        Case 0
            e.Form.controls("Table1").Table.addnew()
            ls1("LSH") = fdr("LSH")
            ls1("FILENAME") = "BKB"  & ".jpg"
            ls1("PGTYPE") = "4"
            ls1("JZLB") = txt2.text
            
            
        Case Else
            e.Form.controls("Table1").Table.addnew()
            ls1("LSH") = fdr("LSH")
            ls1("FILENAME") = i & ".jpg"
            ls1("PGTYPE") = "3"
            ls1("JZLB") = txt2.text
            

    End Select
Next


End If
[此贴子已经被作者于2017/8/31 13:30:58编辑过]

 回到顶部