1.11M Members

Dynamic Controls Class Design

 
0
 

Hi,
I am working on an assignment where i need to create controls dynamically in a Form and when i click "execute button" in the form it should generate a query based on the dynamic controls selection.
Each dynamic control reflect one database column.
The control's can be combo,textbox etc. The execute button is not a dynamic button.
Could you please suggest me a good approach to solve the problem..

Thanks
Subha

 
0
 

If you are using Visual Studio, you could drag a TextBow in a Forms application. See in the generated files how VS does it and act accordingly.

 
0
 

The problem there is i have around 100 controls(columns) and out of that i need only 20 controls to be created dynamically based on some settings. Creating 100 controls where in i need only 20 controls, this may consume much memory space. Please suggest me..

 
0
 

Do I understand you well, do you want to have some sort of "excel-like" sheet wich fetches data from a database after pushing an execute button? Please explain a bit more.

 
0
 

Yes correct.. i am planning to do the same. when i select the columns and when executed it will give me the results.

 
0
 

Use a DataGridView object for that. Example
A DataGridView is rather "heavy" in the beginning to get a grasp on(I was for me!) But in the end it pays off. Success!

 
0
 

You are correct but i needed to use only dynamic controls because of Look and feel.

 
0
 

In the example given the DatgridView is constructed dynamically. Or are you only allowed to use TextBoxes and ComboBoxes?

 
0
 

UI design doesnt allow me to Datagridview. The search would consists of TextBox,Combox box,checked list box,checkbox,datetimectrl etc. The problem i am facing is how should i access the controls througt the file after creating the controls dynamically.

 
0
 

You could dynamically create an array of TextBox objects.
It is for example often done to create a sudoku puzzle etc.

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article