Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

drasko

kosovickosovic Member Posts: 3
Public Class Class3
Dim grbrush As System.Drawing.Drawing2D.LinearGradientBrush
grbrush = New System.Drawing.Drawing2D.LinearGradientBrush(New _
Point(0, 0), New Point(Me.Width, Me.Height), _
Color.Red, Color.Green)
Me.CreateGraphics.FillRectangle(grbrush, New Rectangle(0, 0, _
Me.Width, Me.Height))
End Class


This is exeample where I want to make Class in VB-NET, but it is incorect,I don't know
what is incorect in this code.

In Task List shows error: " grbrush - declaration expected and Me -Syntax error"


Please Help me!!


Comments

  • raymcdraymcd Member Posts: 284
    : Public Class Class3
    : Dim grbrush As System.Drawing.Drawing2D.LinearGradientBrush
    : grbrush = New System.Drawing.Drawing2D.LinearGradientBrush(New _
    : Point(0, 0), New Point(Me.Width, Me.Height), _
    : Color.Red, Color.Green)
    : Me.CreateGraphics.FillRectangle(grbrush, New Rectangle(0, 0, _
    : Me.Width, Me.Height))
    : End Class
    :
    :
    : This is exeample where I want to make Class in VB-NET, but it is incorect,I don't know
    : what is incorect in this code.
    :
    : In Task List shows error: " grbrush - declaration expected and Me -Syntax error"
    :
    :
    : Please Help me!!
    :
    2 Things...

    1) are you extending a class, if so you forgot to inherit.
    2) You need to put all the code in procedures within your class. The only thing you can do is declare variables outside a proc(hence declaration expected).

    If you want to leave it that way, change it from a class to a sub procedure.

    -ray
  • kosovickosovic Member Posts: 3
    : : Public Class Class3
    : : Dim grbrush As System.Drawing.Drawing2D.LinearGradientBrush
    : : grbrush = New System.Drawing.Drawing2D.LinearGradientBrush(New _
    : : Point(0, 0), New Point(Me.Width, Me.Height), _
    : : Color.Red, Color.Green)
    : : Me.CreateGraphics.FillRectangle(grbrush, New Rectangle(0, 0, _
    : : Me.Width, Me.Height))
    : : End Class
    : :
    : :
    : : This is exeample where I want to make Class in VB-NET, but it is incorect,I don't know
    : : what is incorect in this code.
    : :
    : : In Task List shows error: " grbrush - declaration expected and Me -Syntax error"
    : :
    : :
    : : Please Help me!!
    : :
    : 2 Things...
    :
    : 1) are you extending a class, if so you forgot to inherit.
    : 2) You need to put all the code in procedures within your class. The only thing you can do is declare variables outside a proc(hence declaration expected).
    :
    : If you want to leave it that way, change it from a class to a sub procedure.
    :
    : -ray
    : Thank you wery much for great help to me ray.

Sign In or Register to comment.