We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,987 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Dynamic Controls Class Design

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

2
Contributors
9
Replies
2 Hours
Discussion Span
3 Months Ago
Last Updated
10
Views
Subha1983
Newbie Poster
7 posts since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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.

ddanbe
Industrious Poster
4,293 posts since Oct 2008
Reputation Points: 2,121
Solved Threads: 723
Skill Endorsements: 26

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..

Subha1983
Newbie Poster
7 posts since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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.

ddanbe
Industrious Poster
4,293 posts since Oct 2008
Reputation Points: 2,121
Solved Threads: 723
Skill Endorsements: 26

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

Subha1983
Newbie Poster
7 posts since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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!

ddanbe
Industrious Poster
4,293 posts since Oct 2008
Reputation Points: 2,121
Solved Threads: 723
Skill Endorsements: 26

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

Subha1983
Newbie Poster
7 posts since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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

ddanbe
Industrious Poster
4,293 posts since Oct 2008
Reputation Points: 2,121
Solved Threads: 723
Skill Endorsements: 26

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.

Subha1983
Newbie Poster
7 posts since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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

ddanbe
Industrious Poster
4,293 posts since Oct 2008
Reputation Points: 2,121
Solved Threads: 723
Skill Endorsements: 26

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.1087 seconds using 2.7MB