473,383 Members | 1,739 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,383 software developers and data experts.

New obect in a Panel

Hi guys,

I have a panel on a form. I want to add (inside) this panel some textboxes.
Can any body show me with code how this would be done? Until my function
runs, I do not know how many textboxes I need.

Thanks
Bob
Nov 21 '05 #1
3 880
Hi

Dim i As Integer = 0
Dim y As Integer = 0

For i = 0 To 5
Dim text As New TextBox()
text.Name = "text" & CStr(i)
text.Location = New Point(10, y)
text.Text = CStr(i)
Panel1.Controls.Add(text)
y += 20
Next

hth Peter
"Bob Hollness" <bo*@blockbuster.com> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
Hi guys,

I have a panel on a form. I want to add (inside) this panel some textboxes. Can any body show me with code how this would be done? Until my function
runs, I do not know how many textboxes I need.

Thanks
Bob

Nov 21 '05 #2
In addition to peter's answer I would use a hash table, create a shared
instance of the hash table so all textboxes are available to you
throughout your application, and then add handlers based on the names
you give them in the hashtable.

"Bob Hollness" <bo*@blockbuster.com> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl:
Hi guys,

I have a panel on a form. I want to add (inside) this panel some
textboxes.
Can any body show me with code how this would be done? Until my function

runs, I do not know how many textboxes I need.

Thanks
Bob


Nov 21 '05 #3
"Bob Hollness" <bo*@blockbuster.com> schrieb:
I have a panel on a form. I want to add (inside) this
panel some textboxes.


\\\
Dim SampleTextBox As New TextBox()
With SampleTextBox
.Left = 100
.Top = 200
.Height = 20
.Width = 120
.Text = "Foo"
...
End With
Me.Panel1.Controls.Add(SampleTextBox)
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Fabrizio | last post by:
Hi, There is any chance to insert a control like a text box in a panel choosing the absolute position? When I try to insert a label , the panel positions the control on a locked position. Thanks...
9
by: Bill Long | last post by:
I have a control that simply displays a list of links. Following one of the links doesn't post back or redirect to another page, it simply hides the current panel and shows the one you selected......
2
by: Peteroid | last post by:
When the application I'm working on is run it creates a panel with a Paint event customized to draw primitives (circles, rectangles, etc.), places the panel on a form, and then launches the form....
1
by: clintonG | last post by:
I'm having a problem maintaining state with a Panel control in a MasterPage and I need help thinking through this process. The basic structure of the HTML in the Master looks like this... ...
3
by: John Salerno | last post by:
I'm using the sample code of the file 'simple.py' and trying to make a single window with a panel in it, but I keep getting an error. Here's my code: (I know I might need something else, like a...
10
by: markwalker84 | last post by:
Hello everyone! Got a bit of a problem... Two of the panels on my program contain a number of check boxes. The exact number of which is determined by a pair of variables. I have recently...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
11
by: dongarbage | last post by:
Hi there, I'm very much a C# novice. How do you do freehand drawing on a panel with a mouse in c#? Thanks, Don
1
by: kvcraju123 | last post by:
what is your toughest obect in oracle d2k
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.