i have a error message which is : An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication2.exe

Additional information: Object reference not set to an instance of an object.
and it has to do something between the () behind kubus.show for example

Dim kubus As Form2
Dim blok As Form3
Dim cilinder As Form4
Dim piramide As Form5
Dim kegel As Form6
Dim bol As Form7


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim kubus As Form2
Dim blok As Form3
Dim cilinder As Form4
Dim piramide As Form5
Dim kegel As Form6
Dim bol As Form7

If Chkkubus.Checked Then

kubus.Show()

End If


If chkblok.Checked Then

blok.Show()

End If


If chkcilinder.Checked Then

cilinder.Show()

End If


If chkpiramide.Checked Then

piramide.Show()

End If


If chkkegel.Checked Then

kegel.Show()

End If


If chkbol.Checked Then

bol.Show()

End If


End Sub
End Class

Recommended Answers

All 2 Replies

hi
try this
Dim kubus As New Form2
and this for all ur form
i hope it help

you have to define an instance of the form:

Dim kubus As Form2

If kubus Is Nothing Then
kubus = New form2
End If
kubus.ShowDialog()

or as manal says:

Dim kubus As Form2 = new form2
kubus.ShowDialog()

The first one just makes sure there is no instance of the form.
The second one will display a second form.

regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.