Subject: clearing out the form
Posted By: x_ray Post Date: 2/13/2006 3:35:04 PM
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.

Reply By: gbianchi Reply Date: 2/14/2006 8:41:05 AM
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
Reply By: x_ray Reply Date: 2/14/2006 12:34:06 PM
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?

Reply By: gbianchi Reply Date: 2/14/2006 12:43:31 PM
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
Reply By: x_ray Reply Date: 2/14/2006 1:32:13 PM
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.

Reply By: gbianchi Reply Date: 2/14/2006 1:42:57 PM
oooooppppppsss.. sorry... im telling you the way VB 6 will loads controls.. let's restart...

be back to you in some minutes...

HTH

Gonzalo
Reply By: x_ray Reply Date: 2/14/2006 1:50:10 PM
ok tyt

Reply By: gbianchi Reply Date: 2/14/2006 1:50:39 PM
you can add controls to your form with something like this

(ex. that create a combo box)


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
Reply By: x_ray Reply Date: 2/14/2006 2:00:03 PM
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.

Reply By: x_ray Reply Date: 2/21/2006 3:44:09 PM
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.


Go to topic 40234

Return to index page 363
Return to index page 362
Return to index page 361
Return to index page 360
Return to index page 359
Return to index page 358
Return to index page 357
Return to index page 356
Return to index page 355
Return to index page 354