Hi guys,
I am creating several link labels at runtime. I am using the following code:
VB Code:
'Get all questions with matching qID and create linklabels for each. For j As Integer = 0 To PhotoPicker.arrQuestion.Length - 2 If PhotoPicker.arrQuestion(j).qID = questionnaireID Then lnk_Question = New LinkLabel With lnk_Question .Text = PhotoPicker.arrQuestion(j).question.ToString .Top = PhotoPicker.pnl_Questions.Top + (count * 35) .Width = PhotoPicker.pnl_Questions.Width - 25 .Height = 30 .Left = PhotoPicker.pnl_Questions.Left + 10 .Parent = PhotoPicker.pnl_Questions AddHandler lnk_Question.Click, AddressOf lnk_Question_click End With PhotoPicker.pnl_Questions.Controls.Add(lnk_Question) count += 1 End If Next
Now the link labels display fine but when i click on a link label i need to compare the text of the link label to an array and return the element number. Now when i actually click on any link label it returns the text of the last link label created.
Can anybody tell me why it is doing this and how i can get around it?
Thanks in advance for any help
(I am using .net compact framework -> but i dont think that will make a difference to how to tackle this problem.)





Reply With Quote