帮我看看这个哪里错了?为什么会出现错误?
此主题相关图片如下:01.jpg
Dim fr As String
fr = e.Form.name & "_"
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
Dim vr As WinForm.ListViewRow = lvw.Current '获取ListView的当前行
Dim dr As DataRow = vr.tag
Dim lr As WinForm.ListViewRow = e.Sender.Current
MessageBox.Show("你双击的是:" & lr.Text & " " & lr.Group)
Dim n As String = lr.Group & "核价"
Dim tbl As WinForm.Table
tbl = e.Form.CreateSQLTable(n, "Select * fr om {" & n & "}" ,"彬阳数据")
tbl.SetBounds(21, 11, 75, 30)
tbl.Visible = False
e.Form.AddControl(tbl)
MessageBox.Show( Tables(fr & n).Cols.Count)
Dim ps As Integer = Tables(fr & n).FindRow(dr)
MessageBox.Show("1")
If ps >= 0 Then
Forms("窗口2").Open()
Tables(fr & n).Position = ps
For i As Integer = 1 To 15
Forms("窗口2").RemoveControl("TBt" & i)
Forms("窗口2").RemoveControl("lbt" & i)
Next
Dim cnt As Integer
For Each c As WinForm.Control In Forms("窗口2").Controls
If Typeof c Is WinForm.TextBox Then '判断控件是否是文本框
If c.Name.StartsWith("TextBox") Then '而且名称是以TextBox开头
cnt += 1
End If
End If
Next
'MessageBox.Show("控件数量:" & cnt)
Forms("窗口2").Controls("Label2").text = n
Forms("窗口2").Controls("Label1").text = Tables(fr & n).Current(5)
For i As Integer = 1 To 2
Forms("窗口2").Controls("Label" & i).Font = New Font("黑体",12,FontStyle.Regular)
Next
For i As Integer = 1 To Tables(fr & n).Cols.Count - 5
Dim lxt As WinForm.Label
lxt = Forms("窗口2").CreateControl("lbt" & i, ControlTypeEnum.Label)
If i < 6
lxt.Left = 40
lxt.Top = 65+(i)*30
lxt.Height = 23
lxt.Width = 130
lxt.Text = Tables(fr & n).Cols(i+4).Name & ":"
lxt.TextAlign= ContentAlignment.MiddleRight
lxt.Font = New Font("黑体",12,FontStyle.Regular)
Else
lxt.Left = 340
lxt.Top = 67+(i-5)*30
lxt.Height = 23
lxt.Width = 130
lxt.Text = Tables(fr & n).Cols(i+4).Name & ":"
lxt.TextAlign= ContentAlignment.MiddleRight
lxt.Font = New Font("黑体",12,FontStyle.Regular)
End If
Forms("窗口2").AddControl(lxt)
Dim TBt As WinForm.TextBox
TBt = Forms("窗口2").CreateControl("TBt" & i, ControlTypeEnum.TextBox)
If i < 6
TBt.Left = 180
TBt.Top = 65+(i)*30
TBt.Height = 23
TBt.Width = 150
Select Case Tables(fr & n).Cols(i+4).Name
Case "单价" , "金额"
TBt.Value = Format(Round2(Tables(fr & n).Current(Tables(fr & n).Cols(i+4).Name),2),"n")
Case Else
TBt.Value = Tables(fr & n).Current(Tables(fr & n).Cols(i+4).Name)
End Select
'TBt.TextAlign= ContentAlignment.MiddleRight
TBt.Font = New Font("黑体",12,FontStyle.Regular)
Else
TBt.Left = 470
TBt.Top = 65+(i-5)*30
TBt.Height = 23
TBt.Width = 150
Select Case Tables(fr & n).Cols(i+4).Name
Case "单价" , "金额"
TBt.Value = Format(Round2(Tables(fr & n).Current(Tables(fr & n).Cols(i+4).Name),2),"n")
Case Else
TBt.Value = Tables(fr & n).Current(Tables(fr & n).Cols(i+4).Name)
End Select
'TBt.TextAlign= ContentAlignment.MiddleRight
TBt.Font = New Font("黑体",12,FontStyle.Regular)
End If
Forms("窗口2").AddControl(TBt)
Next
End If
If e.Form.ExistControl(n) Then
e.Form.RemoveControl(n)
End If
[此贴子已经被作者于2020/2/23 23:40:12编辑过]