1 Replies - 947 Views - Last Post: 08 July 2014 - 04:47 AM Rate Topic: -----

#1 shihab2555   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-July 14

How can i draw more than one line in wpf using array?

Posted 08 July 2014 - 01:40 AM

I used the following code. I called a method named lets_draw

private void lets_draw() 
{ 
int i,z; 
z = 40; 
Line[] line = new Line[20]; 

for(i=1;i<=10;i++) 
{ 
line[i].Visibility = System.Windows.Visibility.Visible; 
line[i].Stroke = System.Windows.Media.Brushes.Black; 
line[i].X1 = z; 
line[i].X2 = z; 
line[i].Y1 = 40; 
line[i].Y2 = 130; 
z += 10; 
theGrid.Children.Add(line[i]); 
} 
} 


But it showed the following message

"An unhandled exception of type 'System.NullReferenceException' occurred in SkeletalTracking.exe
Additional information: Object reference not set to an instance of an object."

Is This A Good Question/Topic? 0
  • +

Replies To: How can i draw more than one line in wpf using array?

#2 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6535
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: How can i draw more than one line in wpf using array?

Posted 08 July 2014 - 04:47 AM

See first FAQ for a tutorial on this and other error messages.

TOP most asked:
What does this error message mean?
FAQ 2: How do I debug
FAQ 6: How do I make Class1/Form1 talk to Class2/Form2


FAQ (Frequently Asked Questions - Updated July 2014
Spoiler

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1