Click here to Skip to main content
15,894,410 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
In my first form, I have four buttons. 2 of them are disabled when the program starts. In form2 I want the 2 disabled buttons to be enabled when I press a button in Form2.

What I have tried:

I have tried using
If Form2.FinishButton_Click = True Then
PrintButton.Enabled = True
SendButton.Enabled = True
End If
Posted
Updated 29-Aug-18 21:09pm
Comments
[no name] 12-Jul-18 15:35pm    
You need a "reference" to the second form.

With what you've shown, no one can tell what you are doing.

On the form with FinishButton:

VB
Private Sub FinishButton_Click(sender As Object, e As EventArgs) Handles FinishButton.Click

VB
Form1.PrintButton.Enabled = True
Form1.SendButton.Enabled = True
End Sub


Replace "Form1" with the name of the form of PrintButton & SendButton
 
Share this answer
 
'In first form you have to send the form1 in Form2.tag property like below
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
              Dim frm2 As New Form2
              frm2.Tag = Me
              frm2.Show()
  End Sub


'Below codes are in Form2
Private frmlog As Form

   Private Sub Form2_Load(sender As Object, e As EventArgs) Handles Me.Load
       If Not IsNothing(Me.Tag) Then
           Frm1 = DirectCast(Me.Tag, Form)
           Frm1.Hide()

       End If
   End Sub


'Below codes are in Form2

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
         Form1.button1.Enabled = True
         Form1.button2.Enabled = True
  End Sub


'don't forget to accept answer if you got solution
 
Share this answer
 
Your Code is nonsense as it's shown ...

What you have to do is :
Catch the FinishButton.Click-Event on Form2 (with a method).
Inside this method you can set the 'Form1.PrintButton.Enabled = True' and also the 'Form1.SendButton.Enabled = True'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900