I have created a multiple dynamic textboxes based on the columns of the datatable. Every time I change tables the textbox number changed depending on the number of columns the datatable has. Now my question is: to send the values of those dynamic created textboxes to a one textbox or label making one string.
I did that reading the values from a listbox but when the values goes to the textbox the output is a list of lines same as the listbox. so I just want one simple string with all the values in TextBox1.
So even the textbox has Multiline set to false still sending the values to a new line as you see in the output
Here is a pic of the form and the code
'Sample code
Dim ta bles As Data Table = ds.Tables(lbltst.Text) ' lbltst.Text means the table selected
Dim column As DataColumn
For Each tables In ds.Tables
For Each column In tables.Columns
If tables.ToString = lbltst.Text Then
ListBox1.Items.Add(column.ColumnName & ", ") ' the comma to separate the values
End If
Next
Next
TextBox1.Lines = ListBox1.Items.Cast(Of String).ToArray ' From list to textbox
If TextBox1.Text.Length <> 0 Then
TextBox1.Text = TextBox1.Text.Substring(0, TextBox1.Text.Length - 2) 'Deleting the last comma
End If
I did that reading the values from a listbox but when the values goes to the textbox the output is a list of lines same as the listbox. so I just want one simple string with all the values in TextBox1.
So even the textbox has Multiline set to false still sending the values to a new line as you see in the output
Here is a pic of the form and the code
'Sample code
Dim ta bles As Data Table = ds.Tables(lbltst.Text) ' lbltst.Text means the table selected
Dim column As DataColumn
For Each tables In ds.Tables
For Each column In tables.Columns
If tables.ToString = lbltst.Text Then
ListBox1.Items.Add(column.ColumnName & ", ") ' the comma to separate the values
End If
Next
Next
TextBox1.Lines = ListBox1.Items.Cast(Of String).ToArray ' From list to textbox
If TextBox1.Text.Length <> 0 Then
TextBox1.Text = TextBox1.Text.Substring(0, TextBox1.Text.Length - 2) 'Deleting the last comma
End If