16,556
社区成员
发帖
与我相关
我的任务
分享
For i = 0 To DataGridView1.ColumnCount - 1
LableFld(i) = New Label
PanelDetail.Controls.Add(LableFld(i))
LableFld(i).Visible = True
LableFld(i).Left = 100
LableFld(i).Top = txttop + 4 + i * 30
LableFld(i).Text = DataGridView1.Columns(i).HeaderText
LableFld(i).AutoSize = True
TxtFld(i) = New TextBox
PanelDetail.Controls.Add(TxtFld(i))
TxtFld(i).Visible = True
TxtFld(i).Left = 160
TxtFld(i).Top = txttop + i * 30
TxtFld(i).ReadOnly = True
TxtFld(i).Width = 250
If InStr(LableFld(i).Text, "描述") > 0 Then
TxtFld(i).Multiline = True
TxtFld(i).Height = 150
End If
AddHandler TxtFld(i).TextChanged, AddressOf TxtFld_TextChanged '注册txtfld控件数组的TextChanged事件
AddHandler TxtFld(i).Click, AddressOf TxtFld_Click '注册txtfld控件数组的TextChanged事件
Next
点击事件,change的类似
Private Sub TxtFld_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
If Not TypeOf sender Is TextBox Then Exit Sub
For i = 0 To UBound(TxtFld)
If sender.Equals(TxtFld(i)) And InStr(LableFld(i).Text, "类型") > 0 And TxtFld(i).ReadOnly = False Then
ElseIf sender.Equals(TxtFld(i)) And InStr(LableFld(i).Text, "描述") > 0 And TxtFld(i).ReadOnly = False Then
ElseIf sender.Equals(TxtFld(i)) And InStr(LableFld(i).Text, "文件等级") > 0 And TxtFld(i).ReadOnly = False Then
End If
Next
End Sub