473,435 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,435 software developers and data experts.

Dynamically Creating Controls in windows applications

hi,

iam doing a windows application.i have a requirement like to create labels and textboxes dynamically at runtime.iam giving input as number of labels,and textboxes then it will created dynamically.but here i put this controls in a panel.here my problem is all controls are placed in the same position.
but my requirement is all textboxes are arranged one by one.iam trying with this using tablelayoutpanel.but i dont know how to dynamically create columns,rows in tablelayoutpanel.


please anyone help me with this.

iam new to windows application.
iam using vb.net


my code

Dim inttxtcnt As Integer
inttxtcnt = TextBox4.Text

Dim I As Integer

For I = 1 To inttxtcnt
Dim myTextBox = New TextBox
myTextBox.Text = "Control Number:" & I
panel1.Controls.Add(myTextBox)
Next
Sep 12 '08 #1
1 2292
PRR
750 Expert 512MB
"iam doing a windows application.i have a requirement like to create labels and textboxes dynamically at runtime.iam giving input as number of labels,and textboxes then it will created dynamically.but here i put this controls in a panel.here my problem is all controls are placed in the same position.
but my requirement is all textboxes are arranged one by one.iam trying with this using tablelayoutpanel.but i dont know how to dynamically create columns,rows in tablelayoutpanel.


please anyone help me with this.

iam new to windows application.
iam using vb.net


my code

Dim inttxtcnt As Integer
inttxtcnt = TextBox4.Text

int defLocationX=10;
int defLocationY=10;
Literal lt;


Dim I As Integer

For I = 1 To inttxtcnt
Dim myTextBox = New TextBox
myTextBox.Text = "Control Number:" & I
myTextBox.Location.Y=defLocationY;
myTextBox.Location.X=defLocationX+10;
lt = new Literal();
lt.Text = "<br/>";

panel1.Controls.Add(myTextBox)
panel1.Controls.Add(lt)

Next[/quote]

that should do it ....
Check this too
Sep 12 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Altramagnus | last post by:
I have 30 - 40 type of different window. For each type I need about 20 instances of the window. When I try to create them, I get "Error creating window handle" My guess is there is a maximum...
2
by: macca | last post by:
Hi, I am writing a GUI application. It will have a number of user defined controls( I plan to use/create a user defined control that will output alarm states that the user can also select and...
2
by: Patrick | last post by:
I want to define a set of web-form templates in XML and render the equivalent web-form with ASP.NET, then process any input server controls on the form. Reading the XML file from Page_load is...
6
by: Tex | last post by:
I am writting a survey system web application. I am using ASP.Net 2, C# and MS SQL 2005. I am able to store surveys and questions associated to the surveys just fine. The problem I am having is...
9
by: netasp | last post by:
hi all, how can I populate one aspx form when page is loading based on page ID? for example: loading page A (to search for VB code) would display labels and texboxes, dropdown lists all related...
4
by: Henrik Dahl | last post by:
Hello! Is it possible to use Visual Studio 2005 or, secondarily, Visual Studio .NET 2003 to create ActiveX controls which may be consumed by VB 6.0 programs, i.e. dealt with on forms in the...
4
by: mohaaron | last post by:
I can think of a lot of reasons why this might need to be done but as far as I can tell it's not possible. I've been looking for a way to add HtmlTableRows to a table using a button click for a...
8
by: BillE | last post by:
When I create a control dynamically and it grows according to the content, the control Height property still returns the original default control height instead of the height after expanding. ...
1
by: semomaniz | last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.