B
bromptonville-un
Hello,
I'm an amateur in VB6, and I just switched to VB.Net (2003) .
However, I've never used graphicals functions in neither those
language... (Last time I drew something was in VB6).
I just tried the following code and it is not working properly:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim g As Graphics = Form1.CreateGraphics
Dim myPen As New Pen(Color.Red)
myPen.Width = 5
g.DrawLine(myPen, 1, 1, 45, 65)
End Sub
I get the error: "Reference to a non-shared member requires an object
reference."; I don't understand what it means.
I can replace the first line with:
Dim g As Graphics = Me.CreateGraphics
and it works... But I'd like to specify directly the Form1. (I must
also confess I don't perfectly understand the use of the "ME"
keyword...)
Any help would be appreciated.
Thank you.
I'm an amateur in VB6, and I just switched to VB.Net (2003) .
However, I've never used graphicals functions in neither those
language... (Last time I drew something was in VB6).
I just tried the following code and it is not working properly:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim g As Graphics = Form1.CreateGraphics
Dim myPen As New Pen(Color.Red)
myPen.Width = 5
g.DrawLine(myPen, 1, 1, 45, 65)
End Sub
I get the error: "Reference to a non-shared member requires an object
reference."; I don't understand what it means.
I can replace the first line with:
Dim g As Graphics = Me.CreateGraphics
and it works... But I'd like to specify directly the Form1. (I must
also confess I don't perfectly understand the use of the "ME"
keyword...)
Any help would be appreciated.
Thank you.