By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,408 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,408 IT Pros & Developers. It's quick & easy.

dynamic linklabel array

P: 30
am using c# for windows applications.
am using dynamic linklayer array to print some labels in the form.i get some data from the database i add them in the linklabel array and i print it on the screen.
my problem is how to make that linklabel to work when i select the label.am using the code below but is not working:)

Expand|Select|Wrap|Line Numbers
  1. public class Form1 : Form
  2. {
  3. System.Windows.Forms.LinkLabel[] linklabel;
  4.  
  5.  
  6. this.linklabel = new LinkLabel[rowsize];
  7.  
  8. private void linklabelfunction_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  9.         {
  10.              MessageBox.Show("tetininafinsdfns");
  11.         }
  12.  
  13.  
  14. private void InitializeComponent()
  15.       {
  16. this.linklabel[12].LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linklabelfunction_LinkClicked);
  17. }
  18. }
  19.  
when i run the program it get me an error in the last line i upper.
also in my code is the loop that print on the form the labels.
i thing my error is in the lines that i write.could someone help me.
Feb 10 '08 #1
Share this Question
Share on Google+
2 Replies


kenobewan
Expert 2.5K+
P: 4,871
What is the error? Try catch blocks help write errors.
Feb 10 '08 #2

P: 30
the problem is tha it compile me the program but when i run it it get my an error on the just by running the program to that line
i can't put try catch to that part on the program.this code is in the .Desingn.cs part of the program
Expand|Select|Wrap|Line Numbers
  1. this.linklabel[12].LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linklabelfunction_LinkClicked);
  2.  
it just give me an error nullreferenceException unhandled
is this line correct?
Feb 10 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.