dynamic linklabel array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prokopis
    New Member
    • Nov 2007
    • 30

    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:)

    Code:
    public class Form1 : Form
    {
    System.Windows.Forms.LinkLabel[] linklabel;
    
    
    this.linklabel = new LinkLabel[rowsize];
    
    private void linklabelfunction_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
            {
                 MessageBox.Show("tetininafinsdfns");
            }
    
    
    private void InitializeComponent()
          {
    this.linklabel[12].LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linklabelfunction_LinkClicked);
    }
    }
    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.
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    What is the error? Try catch blocks help write errors.

    Comment

    • prokopis
      New Member
      • Nov 2007
      • 30

      #3
      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
      Code:
      this.linklabel[12].LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linklabelfunction_LinkClicked);
      it just give me an error nullreferenceEx ception unhandled
      is this line correct?

      Comment

      Working...