我创建了一个用于编辑数据库记录的屏幕。用户选择表格后,我在 TableLayoutPanel1 中动态添加了标签和文本框。我想知道如何访问 TableLayoutPanel1 内的 TextBox 中存在的值
我使用的代码:
Dim strSQL, strSQL1 As String
Dim ln As Integer
Dim reader As OleDbDataReader
Dim connection As OleDbConnection
Dim ds As New DataSet
connection = New OleDbConnection(CONNECT_STRING)
connection.Open()
ln = 0
strSQL = " select * from syscat.columns where TABSCHEMA like 'QA1MM%' and TABNAME like 'SKU_STR_LIST' with ur "
RichTextBox1.Text = RichTextBox1.Text + strSQL
Dim selectCMD As OleDbCommand = New OleDbCommand(strSQL, connection)
reader = selectCMD.ExecuteReader
MessageBox.Show("Column: " & reader(0) & " ")
While reader.Read()
If String.IsNullOrEmpty(reader(0)) Then
Else
TableLayoutPanel1.ColumnCount = 2
TableLayoutPanel1.RowCount = 20
Dim aLabel As New System.Windows.Forms.Label
Dim aTextBox As New System.Windows.Forms.TextBox
aLabel.Name = "New Label"
aLabel.Text = reader(0).Text
TableLayoutPanel1.Controls.Add(aLabel, 0, ln)
TableLayoutPanel1.Controls.Add(aTextBox, 1, ln)
ln = ln + 1
End If
End While
如何访问我在 TableLayoutPanel1 中动态添加的 aTextBox 中存在的值?