jch001
Newcomer
Im fairly new to VB .NET, and Im stuck on the following problem:
I added a load of controls at runtime from code. Depending on the values in a table, I have a loop which creates a tab page and a button (and other controls on the tab page) at runtime.
I named each button/object with the number of the tab page created e.g. btnDel6 (for the xth Tab Page created e.g. btnDel(x).Name = "btnDelete" & x.ToString ).
I have bound the button to an event handler which works fine. This button will delete the Tab page and the related record in the table. However, I have hit a snag.
I need to reference another control I created on this tab page which stores my database information i.e. the primary key to be used when calling my stored procedure.
I thought it would simply be Me(Control & x.ToString).text
However, I get an error saying Me cannot be indexed because it has no default property. Its got me stumped, Im sure there is an easy answer, I used to do similar things in VBA.
Thanks for any help.
I added a load of controls at runtime from code. Depending on the values in a table, I have a loop which creates a tab page and a button (and other controls on the tab page) at runtime.
I named each button/object with the number of the tab page created e.g. btnDel6 (for the xth Tab Page created e.g. btnDel(x).Name = "btnDelete" & x.ToString ).
I have bound the button to an event handler which works fine. This button will delete the Tab page and the related record in the table. However, I have hit a snag.
I need to reference another control I created on this tab page which stores my database information i.e. the primary key to be used when calling my stored procedure.
I thought it would simply be Me(Control & x.ToString).text
However, I get an error saying Me cannot be indexed because it has no default property. Its got me stumped, Im sure there is an easy answer, I used to do similar things in VBA.
Thanks for any help.
Last edited: