Click here to Skip to main content
13,144,679 members (33,964 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi to all,

this is problem, I create a VB.NET programs, where there are a AccessDB, from table A of this DB I create dynamically a textbox and for each textbox I create two combobox1, the fisrt one it's populated by table B, and until here all are ok, I obtain a form with a line for each record in table A, but now I want to populate the second combobox2 doing a sql query on table C using the value in textbox and combobox1, and here I don't know how to obtain value from dynamic controls.
The problem is that also then I want export each value of line in db or csv.
Can anyone help me please, or paste any example.

Thank a lot.
Posted 18-Nov-12 3:28am
Sergey Alexandrovich Kryukov 18-Nov-12 11:34am
What is the exact type of "TextBox" or "ComboBox"? There is a number of different controls under these names. Full names, please. And you always need to tag UI library you use.

And please don't forget to ask a question.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I resolve using dictionary with integer as ID reference.
Thank a lot for suggestion.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Your controls are part of the Controls collection of the form, but if you're creating them dynamiclaly, you're better off putting them in a collection so you have kept a reference to them and can refer to them from there. You can set their id in code, and look for it, or use a dictionary to map a value ( probably a string ) to each control you want to look for.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 20 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100