Jamesanthony
07-30-2007, 03:00 PM
Hi Alll
Hope you can help
I have this code
NoOfFields = CInt(ds.Tables(gTableName).Columns.Count)
For gInt1 = 0 To NoOfFields - 1
Select Case gInt1
Case 0
TextBox0.DataBindings.Add("Text", ds.Tables!clients, ds.Tables(gTableName).Columns(gInt1).Caption)
Label0.Text = ds.Tables(gTableName).Columns(gInt1).Caption
Case 1
TextBox1.DataBindings.Add("Text", ds.Tables!clients, ds.Tables(gTableName).Columns(gInt1).Caption)
Label1.Text = ds.Tables(gTableName).Columns(gInt1).Caption
Case 2
TextBox2.DataBindings.Add("Text", ds.Tables!clients, ds.Tables(gTableName).Columns(gInt1).Caption)
Label2.Text = ds.Tables(gTableName).Columns(gInt1).Caption
End Select
Next gInt1
The only difference with the select case statement is the textbox(X)
In VB6 I could say
Str1 = "TextBox" & cstr(gint1)
then use
str1(Databindings).add)"Tex..................................
I could possibly have 12 textboxes
Thanks
Hope you can help
I have this code
NoOfFields = CInt(ds.Tables(gTableName).Columns.Count)
For gInt1 = 0 To NoOfFields - 1
Select Case gInt1
Case 0
TextBox0.DataBindings.Add("Text", ds.Tables!clients, ds.Tables(gTableName).Columns(gInt1).Caption)
Label0.Text = ds.Tables(gTableName).Columns(gInt1).Caption
Case 1
TextBox1.DataBindings.Add("Text", ds.Tables!clients, ds.Tables(gTableName).Columns(gInt1).Caption)
Label1.Text = ds.Tables(gTableName).Columns(gInt1).Caption
Case 2
TextBox2.DataBindings.Add("Text", ds.Tables!clients, ds.Tables(gTableName).Columns(gInt1).Caption)
Label2.Text = ds.Tables(gTableName).Columns(gInt1).Caption
End Select
Next gInt1
The only difference with the select case statement is the textbox(X)
In VB6 I could say
Str1 = "TextBox" & cstr(gint1)
then use
str1(Databindings).add)"Tex..................................
I could possibly have 12 textboxes
Thanks