liljoedaprince
New member
- Joined
- May 3, 2010
- Messages
- 1
- Programming Experience
- Beginner
VB.NET:
Public xPos As Integer = 1
Public yPos As Integer = 1
Public xPos1 As Integer = 2
Public yPos1 As Integer = 2
Public Drawgraphics As Graphics
Dim myPen As New Pen(Color.BlueViolet, 3)
Public MouseDowned As Boolean = False
Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
xPos = Control.MousePosition.X
yPos = Control.MousePosition.Y
MouseDowned = True
End Sub
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
xPos = Control.MousePosition.X
yPos = Control.MousePosition.Y
MouseDowned = True
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
Label1.Text = Control.MousePosition.X
Label2.Text = Control.MousePosition.Y
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
If MouseDowned = True Then
xPos1 = Control.MousePosition.X
yPos1 = Control.MousePosition.Y
MouseDowned = False
Drawgraphics.DrawLine(myPen, xPos, yPos, xPos1, yPos1)
End If
End Sub
I get the error NullReferenceExeption was unhandled. Object reference not set to an instance of an object.
Please help!!!!! thanks