469,628 Members | 1,109 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,628 developers. It's quick & easy.

dynamic linklabel array

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;
  6. this.linklabel = new LinkLabel[rowsize];
  8. private void linklabelfunction_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  9.         {
  10.              MessageBox.Show("tetininafinsdfns");
  11.         }
  14. private void InitializeComponent()
  15.       {
  16. this.linklabel[12].LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linklabelfunction_LinkClicked);
  17. }
  18. }
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
2 1931
4,871 Expert 4TB
What is the error? Try catch blocks help write errors.
Feb 10 '08 #2
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);
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.

Similar topics

reply views Thread by tota | last post: by
3 posts views Thread by vince | last post: by
reply views Thread by Suz | last post: by
1 post views Thread by Marcus Kwok | last post: by
2 posts views Thread by Terrance | last post: by
4 posts views Thread by David Veeneman | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.