user2219566
user2219566

Reputation: 1

Cannot open a form in VB.net 2010 with .show()

I am simply trying to open a new form using 'Exercise.show()' as this has work until now, however with this Exercise form, it is not being shown as an option as a form so I cannot open it. What should I do here?

Private Sub Exercises_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Exercises.Click
    Exercises.Show()

    Me.Hide()

End Sub

Upvotes: 0

Views: 5337

Answers (4)

Eddy Jawed
Eddy Jawed

Reputation: 457

If your actual form is called 'Exercises' then you need to type:

    Dim frm As New Exercises        
    frm.ShowDialog()

Thanks

Eddy Jawed

Upvotes: 1

sansalk
sansalk

Reputation: 4741

    Dim objPDetails As PFErrors

    Dim IsOpen As Boolean = False
    For Each f As Form In Application.OpenForms
        If f.Name = "PFErrors" Then
            IsOpen = True
            f.Focus()
            Exit For
        End If
    Next

    If IsOpen = False Then
        objPDetails = New PFErrors
        objPDetails.WindowState = FormWindowState.Maximized
        objPDetails.MdiParent = Me
        objPDetails.Show()
    End If

Upvotes: 0

Nore
Nore

Reputation: 111

Change .Show with ShowDialog()

Exercises.ShowDialog()

Upvotes: 0

coder
coder

Reputation: 13250

Try this:

Dim oForm As Exercises
oForm = New Exercises()
oForm.Show()

Upvotes: 1

Related Questions