以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 版主指点一下这段代码怎么写才能紧凑和正确? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=106024) |
-- 作者:旭日生 -- 发布时间:2017/8/31 13:30:00 -- 版主指点一下这段代码怎么写才能紧凑和正确? 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编辑过]
|
-- 作者:有点甜 -- 发布时间:2017/8/31 14:13:00 -- 改代码,如
Case Else ls1 = e.Form.controls("Table1").Table.addnew()
ls1("LSH") = fdr("LSH")
ls1("FILENAME") = i & ".jpg"
ls1("PGTYPE") = "3"
ls1("JZLB") = txt2.text
|