I have a database which stores details of different department. Each department have uneven number of members. Eg.

Table field
Department A
President : 1
Vice President : 3
Treasurer : 1
Secretary : 3
Committee : 10

Department B
President : 1
Vice President : 4
Treasurer : 1
Secretary : 2
Committee: 15

So they are unevenly distributed, I can't use a static Form where all textboox are pre-designed. The form needs to be flexible, and dynamic according to the data selected.

  1. What will be the best approach?
  2. If i were to use label and textbox to display the contents, how will i do it??

Please help.


What you mean by flexible?

I mean a code driven textbox. WHich will response to the number of records.

For instance, when there are 5 records, the 5 textbox will be created with the corrensponding 5 data from the database, and if 7 records, 7 textbox filled with the data from database.


Using Object Type variable you can do this dynamically. Please read this, which can give you a way to solve your problem.