|
-
Jul 21st, 2004, 07:24 PM
#1
Thread Starter
Member
TextBox in Structure
Does anyone know how to create a structure that includes a textbox... so that when i create a new instance of the structure, i can create a new textbox.
IE.
Code:
structure newTextbox
dim txtBox as textbox
dim isMovable as boolean
end structure
sub someSub()
dim x as newTextbox
me.controls.add(x.txtbox)
end sub
U S A
Visual Studio .NET
Windows XP
-
Jul 21st, 2004, 08:28 PM
#2
That should work, you just need to instantiate the textbox object before adding it to the form.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jul 21st, 2004, 08:55 PM
#3
Fanatic Member
in addition to master crptcblade
VB Code:
option strict on
imports system
imports system.windows.forms
public class example
inherits form
structure newTextBox
dim t as textbox
dim i as boolean
end structure
sub new()
dim x as newTextBox
[i]x.t=new textbox()[/i]
me.controls.add(x.t)
end sub
shared sub main()
application.run(new example())
end sub
end class
-
Jul 23rd, 2004, 02:58 PM
#4
Thread Starter
Member
Thanks
Thank you for the replies... I found that I could create a sub in the structure that called a new textbox. So i did it as follows.
VB Code:
structure example
dim txtBox as textbox
dim x as integer
sub setup
txtbox = new textbox
end
end structure
sub main()
dim ex as example
ex.setup
me.controls.add(ex.txtBox)
end sub
I was also debating on weather or not to create a new class.
U S A
Visual Studio .NET
Windows XP
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|