Referencing a control programatically with external source

Posted by James on Stack Overflow See other posts from Stack Overflow or by James
Published on 2010-01-30T03:18:07Z Indexed on 2010/04/08 8:03 UTC
Read the original article Hit count: 497

Filed under:
|
|
|

Forgive me about the title, I have no idea what this is called.

I have a MS Access database set up, with a Period field that has either values 1, 2, 3, 4 or 5. I retrieve these values using a database connection and I would like to reference a particular control based on what period was grabbed from the database.

Here's example code, pseudo of course.

TextBox(dr(3)).Text = dr(0)

dr(3) contains the period, and dr(0) contains the content I would like to put into the text box. I have these text boxes on my form: TextBox1, TextBox2, TextBox3, TextBox4 and TextBox5.

So if dr(3) contained 2 then I would want to reference TextBox2.

I hope I've made myself clear, any help would be greatly appreciated, thanks. :)

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about database