Question Help with dynamic textbox's

I.odine

New member
Joined
Apr 3, 2009
Messages
1
Programming Experience
1-3
Hey Guys,

i was wondering if i could get a hand with something here. I have been tryig for the past 6 hours ( i am not even kidding) to make a page that parses some info from a text (.js) file, displays it on the form, and allows the user to make changes and resave the file.

I have got as far as NO WHERE! i have been completly hung up on creating dynamic textbox's. To start. I have been able to parse the file and get the strings i need to display, and store them in an array. They come in groups of 2 (i.e Title, and URL) now the file currently has 2 sets of these. but in the future may have many more, which is why i need the page to dynamically create enough textbox pairs to display each of the entires.

i think i am able to get the loop working to make the textboxes using a basic

VB.NET:
dim newBox as New Textbox
newBox.ID = "Box" & i
Form1.Controls.Add(newBox)

or something like that (i closed VWB now as i am so pissed off with it.)

the issue with this is that i cannot for the life of me find the textbox after i make it (after runtime) it appears on the page, but no code i seem to come up with can find the textbox again! i mean, eventually i will need to get the .text info from each box and write it back to the file. I have tried every type of "Me.Form1.FindControl("Box"&i)" i can think of and nothing. I have tried looking through the debugger locals but find nothing, not a single mention to the ID i specified (or the "newBox" for that matter)

Frustrating and missing half of my hair now I have thrown my hands in the air and decided to ask for help.

First step is going to be to create as many pairs of textboxes as i have entries in my array (holding the strings from the file).

Second step is to populate the textboxes with the array strings
ie. Box1.text = myArray(1)

and i think thats a solid start!

If anyone can help me with this i would be forever greatful!!! i have completly wasted my Thursday evening trying to figure this out!

I am more/less a begginner at this stuff so please be gentle! lol.

Thanks in advance!

--][--
 
Not sure I completly understand your post & question but wouldnt it be easier to read the file(s) into a DataSet or DataTable and bind that to a DataGridView instead? This way you dont have to worry about the ever changing number of records or columns per file.
 
Back
Top