How to reload a form?

falled

Member
Joined
Sep 16, 2006
Messages
20
Programming Experience
Beginner
I need help please

I have a form with many buttons.

If you click a button it reduces his width with a determinate length but I want to reload the form if the user isn't happy with the results.

I don't want to store all the initials sizes and then changed all again

Any idea??

Thank you all!!!!
 
in the
sub of form_load (...) handle form.load

' enter ur intial sizes here
End Sub

then make a button for wutever u want to do to reload ..

button_click (...) handles button.click

Me.Load
End sub

this method is going to load again the form and the first method handles when the form is loaded wut sizes to be in when it is loaded ..

I hope i helped you ..
 
I don't want to store all the initials sizes and then changed all again

falled, if you want to back to the initial page size, you have to save the initial size for later use.

Thank's
Inhua
 
Well I'm not sure about that

In the Load method I create the buttons with a sizes stored on a database so in some way I have the values stored yet.

I create all the buttons and the form dinamically during the load method

Thank you to answer me
 
Build a procedure (not the form load procedure) that is called from the form load procedure

You can do 2 things here:

1) Connect to the database from this procedure and gather all of the values to set the button's sizes.
VB.NET:
Private form_load(...) Handles MyBase.Load
    SetButtons(True)
End Sub
 
Private Sub IHateItButton_Click(...) Handles IHateItButton.Click
    SetButtons(False)
End Sub
 
Private Sub SetButtons(ByVal CreateButtons as Boolean)
    'Connect to the database
    'Gather data
    If CreateButtons Then
        'Code to create the buttons
    End If
    'Code to set the buttons sizes
End Sub

2) Store the values from the database in an array in the form load procedure and use this procedure to reset the sizes based on the values in the array.
VB.NET:
Private ButtonSizes(0) as string 'or whatever datatype they are
 
Private form_load(...) Handles MyBase.Load
    'Connect to the database
    'Gather data
    'Code to create the buttons
    'Code to store button sizes in the array ButtonSizes
End Sub
 
Private Sub IHateItButton_Click(...) Handles IHateItButton.Click
    SetButtons()
End Sub
 
Private Sub SetButtons()
    'Code to loop through the ButtonSizes array and reset the buttons sizes
End Sub

Im sure there are other ways to accomplish this, but these are my ideas. Personally, i would probably choose option 1.
 
Back
Top