Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,095 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,823 people online right now. Registration is fast and FREE... Join Now!




make a new cotrol problem

 
Reply to this topicStart new topic

make a new cotrol problem

RudyVB.net
5 Jun, 2008 - 08:05 AM
Post #1

D.I.C Head
**

Joined: 3 May, 2008
Posts: 61

hello all!

CODE
lblinm2 = frmAT.Controls("txtCommand")
                lblinm2.Name = "prtend" + btn.Name
                MsgBox(lblinm2.Text.ToString)
                MsgBox(lblinm2.Name.ToString)
                Me.Controls.Add(lblinm2)

This code makes on control, but it's nor making mulitiple controls. What am I missing?
Thanks!

Rudy
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Make A New Cotrol Problem
5 Jun, 2008 - 12:02 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,319



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Can you describe exactly what you want it to do?


User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Make A New Cotrol Problem
5 Jun, 2008 - 12:53 PM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
If I'm reading your post correctly you're wanting that to make multiple controls, well the way it is setup now it will make but a single control, for multiples you will need to put that code into a loop


vb

For i As Integer = 0 To YourNumber
'Put code in here to create controls
Next

User is offlineProfile CardPM
+Quote Post

RudyVB.net
RE: Make A New Cotrol Problem
6 Jun, 2008 - 06:19 AM
Post #4

D.I.C Head
**

Joined: 3 May, 2008
Posts: 61

QUOTE(PsychoCoder @ 5 Jun, 2008 - 01:53 PM) *

If I'm reading your post correctly you're wanting that to make multiple controls, well the way it is setup now it will make but a single control, for multiples you will need to put that code into a loop


vb

For i As Integer = 0 To YourNumber
'Put code in here to create controls
Next



Hey Psycho!

Duh! I didn't even think of that. I actually need it to make a new label per button click, instead of all at the same time. But you pointed me in the right direction. I think a simple array would work out well.
This is what I did. Thanks for the shove! LOL! smile.gif

CODE
Private lblPECounter As Integer = 0
    Private lblPEArray As New ArrayList

Dim LblPE As New Label
                Dim Rand As New Random
                LblPE.Left = Rand.Next(150, Me.Width - LblPE.Width)
                LblPE.Visible = False
                lblPECounter += 1
                LblPE.Tag = btn.Name.ToString
                LblPE.Text = frmAT.txtCommand.Text

                Me.Controls.Add(LblPE)
                lblPEArray.Add(LblPE)

User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Make A New Cotrol Problem
6 Jun, 2008 - 12:05 PM
Post #5

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
No problem, glad I could help smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 12:12AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month