B
Bill English
I'm 14 and just started programming last week, so this is
probably an easy question.
How do I resolve this error:
An unhandled exception of
type 'System.NullReferenceException' occurred in Software
Inventory (My Version).exe
Additional information: Object reference not set to an
instance of an object.
I have a form called form1 with a mainmenu that has a
button that shows a form called fmOpacity, which I want
to control opacity of form1. This is the code I used in
fmOpacity (tb is a trackbar):
Private Sub TrackBar1_Scroll(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
tb.Scroll
'
'Sets main form's transparency.
'
Dim trans As Form1
If tb.Value = 0 Then trans.Opacity = 0.1
If tb.Value = 1 Then trans.Opacity = 0.2
If tb.Value = 2 Then trans.Opacity = 0.3
If tb.Value = 3 Then trans.Opacity = 0.4
If tb.Value = 4 Then trans.Opacity = 0.5
If tb.Value = 5 Then trans.Opacity = 0.6
If tb.Value = 6 Then trans.Opacity = 0.7
If tb.Value = 7 Then trans.Opacity = 0.8
If tb.Value = 8 Then trans.Opacity = 0.9
If tb.Value = 9 Then trans.Opacity = 1
End Sub
probably an easy question.
How do I resolve this error:
An unhandled exception of
type 'System.NullReferenceException' occurred in Software
Inventory (My Version).exe
Additional information: Object reference not set to an
instance of an object.
I have a form called form1 with a mainmenu that has a
button that shows a form called fmOpacity, which I want
to control opacity of form1. This is the code I used in
fmOpacity (tb is a trackbar):
Private Sub TrackBar1_Scroll(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
tb.Scroll
'
'Sets main form's transparency.
'
Dim trans As Form1
If tb.Value = 0 Then trans.Opacity = 0.1
If tb.Value = 1 Then trans.Opacity = 0.2
If tb.Value = 2 Then trans.Opacity = 0.3
If tb.Value = 3 Then trans.Opacity = 0.4
If tb.Value = 4 Then trans.Opacity = 0.5
If tb.Value = 5 Then trans.Opacity = 0.6
If tb.Value = 6 Then trans.Opacity = 0.7
If tb.Value = 7 Then trans.Opacity = 0.8
If tb.Value = 8 Then trans.Opacity = 0.9
If tb.Value = 9 Then trans.Opacity = 1
End Sub