vb.net 2k3:
I have this code that doesn't work unless I take out the g.DrawString statements. If anyone can look over the code and tell me why I'd appreciate it. The Error is Object reference not set to an instance of an object.
I have this code that doesn't work unless I take out the g.DrawString statements. If anyone can look over the code and tell me why I'd appreciate it. The Error is Object reference not set to an instance of an object.
VB.NET:
Dim g As Graphics
Dim LabelText As String
LabelText = "--"
x = x + 20
Dim varSlash As String
varSlash = "/"
Dim brushColor As System.Drawing.Color
Dim blackBrush = New SolidBrush(SystemColors.WindowText)
Dim blueBrush = New SolidBrush(brushColor.Blue)
Dim greenBrush = New SolidBrush(brushColor.Green)
Dim redBrush = New SolidBrush(brushColor.Red)
Dim yellowBrush = New SolidBrush(brushColor.Yellow)
Dim grayBrush = New SolidBrush(brushColor.Gray)
Dim labelFont As New Font("Arial", 40)
Dim format As New StringFormat
format.Alignment = StringAlignment.Center
format.LineAlignment = StringAlignment.Center
y = 200
g.DrawString(varSection.ToString, Font, blackBrush, x, y)
y = y + 15
g.DrawString(LabelText.ToString, Font, blackBrush, x, y)
y = y + 5
g.DrawString(varCheckList.ToString, Font, blackBrush, x, y)
y = y + 50
g.DrawString(varValidated.ToString, Font, blueBrush, x, y)
y = y + 10
g.DrawString(varSlash.ToString, Font, blackBrush, x, y)
y = y + 10
g.DrawString(varAwaiting.ToString, Font, greenBrush, x, y)
y = y + 10
g.DrawString(varSlash.ToString, Font, blackBrush, x, y)
y = y + 10
g.DrawString(varNot.ToString, Font, redBrush, x, y)
y = y + 10
g.DrawString(varSlash.ToString, Font, blackBrush, x, y)
y = y + 10
g.DrawString(varFollow.ToString, Font, yellowBrush, x, y)
y = y + 10
g.DrawString(varSlash.ToString, Font, blackBrush, x, y)
y = y + 10
g.DrawString(varNA.ToString, Font, grayBrush, x, y)