Show Form and Disable Button

Joined
Aug 28, 2008
Messages
13
Programming Experience
Beginner
Hi again friends
i have uploaded 3 pics shows 3 diff forms.
1. BaseForm.( Includes 2 button, Buttons Text "Form1" and "Form2")
2. Form1. (Just inherited BaseForm)
3. Form2. (Just inherited BaseForm)

I have tried a lot and google a lot but cant find...
Anyway I am asking for help here.:)

If the Button Form1 clicked then
it shows Form1
disable Form1 button.
and
Hide BaseForm.

same action for Button Form1.
Can anyone show me some code or sample plz.

My other question is
When I click the Right Top Cross button then the Background BaseForm Still running. I want to close all form If I click cross.
How Can it possible. Plz show mw the way.

Thanks Friends.:)
 

Attachments

  • baseform.JPG
    baseform.JPG
    10.6 KB · Views: 26
  • form1.JPG
    form1.JPG
    10.5 KB · Views: 26
  • form2.JPG
    form2.JPG
    10.6 KB · Views: 26
In the Button1.click event:

VB.NET:
Dim frm As New From1
frm.Show
Button1.Enabled = False
Me.Hide

Then select 'When last form closes' on the Shutdown Mode on the application page.
 
Thanks 4 your answer.
But sorry friend I have tried earlier this way but doesnt work.
Actually u didnt get the point. When I click the button form1 it open the form Form1 but in the background the Baseform also loaded and didnt get the click event. As a result button enabled.

Anyway Thanks for reply.
 
Or

VB.NET:
   Form2.Show()
        Button1.Enabled = False
        Form2.Button1.Enabled = False
        Me.Hide()

It is hard to understand exactly what you are looking for...
 
i have uploaded my sample problem
If anyone interested to ans me plz reply

My problem is when I click Form1 it shows form Form1 and disable Form1 button.

And when i click cross the background form Baseform is hide not close.

Thanks
 

Attachments

  • TestProg.zip
    15.7 KB · Views: 18
Answer to form close problem

Hi

If you have form1 open and baseform hidden then just use the following code to close base form when form1 closes. It should be placed in form1 not baseform.

VB.NET:
Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        BaseForm.Close()
    End Sub

With reference to your other query, do you want baseform.button1 disabled or form1.button1 disabled?

good luck in the meantime
 
Back
Top