none
Button Shows one form but closes itself... RRS feed

  • Question

  • Hello, I am making  a Program that has  a button that opens a new Form but closes itself here is my code:

       Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            If TextBox1.Text = "Hi" And TextBox2.Text = "Hi" Then
    
                Me.Show(False)
                HqMain.Show()
    
            Else
                MsgBox("Sorry, username or password not found", MsgBoxStyle.OkOnly, "Invalid")
            End If
        End Sub
    At the Me.Show(False) I get an error saying: Error BC30311: Value of type 'Boolean' cannot be converted to 'IWin32Window'. 

    Thursday, March 2, 2017 12:01 AM

Answers

  • Hello, I am making  a Program that has  a button that opens a new Form but closes itself here is my code:

       Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            If TextBox1.Text = "Hi" And TextBox2.Text = "Hi" Then
    
                Me.Show(False)
                HqMain.Show()
    
            Else
                MsgBox("Sorry, username or password not found", MsgBoxStyle.OkOnly, "Invalid")
            End If
        End Sub
    At the Me.Show(False) I get an error saying: Error BC30311: Value of type 'Boolean' cannot be converted to 'IWin32Window'. 

    Me.show does not want a boolean, what are you wanting to do ?
    If you want to hide the main form, use Me.Hide

    Thursday, March 2, 2017 12:08 AM

All replies

  • Hello, I am making  a Program that has  a button that opens a new Form but closes itself here is my code:

       Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            If TextBox1.Text = "Hi" And TextBox2.Text = "Hi" Then
    
                Me.Show(False)
                HqMain.Show()
    
            Else
                MsgBox("Sorry, username or password not found", MsgBoxStyle.OkOnly, "Invalid")
            End If
        End Sub
    At the Me.Show(False) I get an error saying: Error BC30311: Value of type 'Boolean' cannot be converted to 'IWin32Window'. 

    Me.show does not want a boolean, what are you wanting to do ?
    If you want to hide the main form, use Me.Hide

    Thursday, March 2, 2017 12:08 AM
  • Thanks so much, I've been trying to fix this myself before I posted this for a half an hour.
    Thursday, March 2, 2017 12:11 AM