 |
| VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1). |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 13th, 2006, 04:35 PM
|
|
Authorized User
|
|
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
clearing out the form
hello all,
i am new to vb.net 2003, and need some help about a couple of things:
-i have a form with multiple controls on it(menus,toolbars,txtbx,labels,....), i need to clear the form from all the components and after it create, on the same form other components.
-i need to know how to use the progress bar control, timer control,and tabbed form control.(i looked into my book Begining Visual Basic .Net 2003 but didn't find(or missed,sorry) info about these)
i will google a little for the second question, but i appreciate any help or reply for the above.
|
|

February 14th, 2006, 09:41 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
hi there...
about the first one that really doesn't sound ok.. why cleaning up a form to make a new one?? why just not create a new one?? maybe more info about what are you trying to accomplish will give us a better perpective...
about the second, all the info you need is on the msdn under that controls...
HTH
Gonzalo
|
|

February 14th, 2006, 01:34 PM
|
|
Authorized User
|
|
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
in the first question,clearing a form and generating new components, all i wanted to say is that if i have a form, and i dont want to create another new one,(i.e i want to reuse it),is there a way to clear it and generate new components at run time?
even if there is no way to do it, is it possible to generate new components at run time?
|
|

February 14th, 2006, 01:43 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
ok.. you can do that.. but you will need all the controls (the old ones and the new ones) on the form. to load a control you need one control into an array of controls and use the load statement.
but you will have a lot of problems controling the events for the controls.
if you want to reuse code better put it in a module or even better on a class
to unload controls use the unload statement (but you will need one always loaded b/c you cannot create a control from nothing.)
feel free to keep asking :)
HTH
Gonzalo
|
|

February 14th, 2006, 02:32 PM
|
|
Authorized User
|
|
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i understand from the above that all the controls must be pre-made and stored into array and there will be problems. however the second idea sounds better, but sorry i didn't grasp it especially stuff between (), can you give me a little example(as one once said, an example worth 1000 words).
Thank you for your patience.
|
|

February 14th, 2006, 02:42 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
oooooppppppsss.. sorry... im telling you the way VB 6 will loads controls.. let's restart...
be back to you in some minutes...
HTH
Gonzalo
|
|

February 14th, 2006, 02:50 PM
|
|
Authorized User
|
|
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ok tyt
|
|

February 14th, 2006, 02:50 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
you can add controls to your form with something like this
(ex. that create a combo box)
Code:
Private Function CreateCB() As ComboBox
Dim cb As New ComboBox()
Me.Controls.Add(cb)
cb.Dock = DockStyle.Top
CreateCB = cb
End Function
remember that you can add events to your new control to (i dont remeber the statement for that, but is not dificult).
hope this now help...
HTH
Gonzalo
|
|

February 14th, 2006, 03:00 PM
|
|
Authorized User
|
|
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ok thanks i will try this now, and reply to you if i had any problems.
btw what about positioning the control,suppose a label for example?(if you have a quick answer so be it, if not i am searching the net anyway)
thanks a lot.
|
|

February 21st, 2006, 04:44 PM
|
|
Authorized User
|
|
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hello again,
i have a somewhat similar question, what if after an application is ran, i want to restore it to its initial state, i.e. suppose a group of labels and text boxes and buttons were enabled,created written to etc..., i want after some event that the form returns to its initial state,i.e. when it first ran, could it be possible?( VB.Net 2003)
thanks in advance.
|
|
 |