Hi, there is probably a simple soltion to this, i have been looking for a solid hour now on the internet but cant find how it is done. Here is my problem.
I have a form where a number of textboxes are programmatically created within a flowLayoutPanel and named by adding together 2 strings.
With the click of another button i hope to have all the values entered into these text boxes stored in a text file. However, i cant seem to find a way to add strings together to allow me to retrieve the values entered within the text boxes created.
Below is the code i have so far:
BTW FLP is my flow layout panel and c is my calculated nmber of textboxes that are created.
Below is my code for exporting to file
Sorry if this doesnt make any sense, i havent done much programming before and just trying to find my feet.
Many Thanks, Wilson.
I have a form where a number of textboxes are programmatically created within a flowLayoutPanel and named by adding together 2 strings.
With the click of another button i hope to have all the values entered into these text boxes stored in a text file. However, i cant seem to find a way to add strings together to allow me to retrieve the values entered within the text boxes created.
Below is the code i have so far:
BTW FLP is my flow layout panel and c is my calculated nmber of textboxes that are created.
VB.NET:
Private Sub createTB(ByVal c As Integer)
Dim x1 As Integer = 1
Dim y As Integer = 2
Dim str As String = "TBX"
Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("C:\Users\Wilson\Documents\test.txt", True)
Do Until x1 = c + 1
Dim x2 As String = Convert.ToString(x1)
Dim nme As String = str + x2
Dim NTB1 As New TextBox With {.Size = (New Size(60, 20)), .Anchor = AnchorStyles.Left, .Name = nme, .Text = "HelloCruelWorld"}
Dim NTB2 As New TextBox With {.Size = (New Size(60, 20)), .Anchor = AnchorStyles.Bottom}
Dim NLB1 As New Label With {.Text = "Heat No.: ", .Anchor = AnchorStyles.Left}
Dim NLB2 As New Label With {.Text = "Riders in Heat: ", .Anchor = AnchorStyles.Bottom}
FLP.Controls.Add(NLB1)
FLP.Controls.Add(NTB1)
FLP.Controls.Add(NLB2)
FLP.Controls.Add(NTB2)
x1 = x1 + 1
Loop
VB.NET:
private sub Export_To_File(byval c as integer) Handles BTN2.Click
For val1 As Integer = 1 To c
Dim tbp1 As String = Convert.ToString(val1)
Dim nme As String = str + tbp1
Dim txt As String = ".text"
file.WriteLine([nme] + [txt])
Next
file.close()
endsub
Many Thanks, Wilson.