I have a program in which I create labels as follows:
This gives me a 'column' of 42 Branch namesCode:r = 137 Dim j As Integer For j = 1 To Bcount Dim lbl As New Label lbl.Name = "lbl" & j lbl.Text = Branch(j) lbl.Location = New Point(1095, r) Controls.Add(lbl) r = r + 30 Next
I then created three 'columns of textboxes alongside the labels using:
My question is; how do I now access these textboxes to input data from a product usage txt file?Code:r = 134 Dim t As Integer = 100 For j = 1 To Bcount Dim tb1 As New TextBox Dim tb2 As New TextBox Dim tb3 As New TextBox tb1.Name = "tb" & t tb1.Tag = Branch(n) tb1.Size = New Size(40, 20) tb2.Name = "tb" & t + 1 tb2.Size = New Size(40, 20) tb3.Name = "tb" & t + 2 tb3.Size = New Size(40, 20) tb1.Location = New Point(1200, r) Me.Controls.Add(tb1) tb2.Location = New Point(1250, r) Me.Controls.Add(tb2) tb3.Location = New Point(1300, r) Me.Controls.Add(tb3) r = r + 30 t = t + 3 Next
In other words:
The first label is for a branch called Abel. I want to put that branch's usages of a particular product in the adjacent textbox. The index for the usage file is (a). The reason for three textboxes adjacent to each label is to get the usage figures for each of the past three months. My problem is that I can't seem to access the individual textboxes by name.
Using the above code I thought I'd named the first textbox as "tb1" + 100, but it doesn't seem to be that simple and I'm stuck.
Just ask if you need additional information.




Reply With Quote
