I am trying to draw a line on a form with the following code, but I get a strange error....
Error:Code:private void button2_Click(object sender, System.EventArgs e) { Graphics g; Pen aPen = new Pen(Brushes.Black, 2); g.DrawLine(aPen, 100,100,300,300); }
C:\Documents and Settings\carsten\My Documents\Visual Studio Projects\sharp_test_obel\Form1.cs(228): Use of unassigned local variable 'g'
What am I doing wrong?




Reply With Quote