why do i get "declaration expected" on this line??

eramgarden

Well-known member
Joined
Mar 8, 2004
Messages
579
Im working on a Image application...

Im putting the code in a class:

But get "declaration expected" for the variable "g"


Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Net
Imports System.IO


Public Class Image

Dim bmp As Bitmap = New Bitmap("Image.tif")
Dim g As Graphics = Graphics.FromImage(bmp)
Dim boldFont As Font = New Font("Times New Roman", 10, FontStyle.Bold)

g.DrawString("Im A Button!", boldFont, Brushes.Black, 10.0f, 10.0f)

End Class

any ideas?
 
The line highlighted needs to be executed from within a Method (function or sub) you cannot just execute code directly at the class level like that.
 
Back
Top