S skcud Member Nov 24, 2011 #1 Hey guys. I have 3 sets of arrays of labels totalling a potential of 90 labels being utilised. I need to capture a 'click' event for each of these labels. Please, please tell me there is a way of doing this without having to write out the code for a click event for all 90 labels. Thanks for your time. :sign0085:
Hey guys. I have 3 sets of arrays of labels totalling a potential of 90 labels being utilised. I need to capture a 'click' event for each of these labels. Please, please tell me there is a way of doing this without having to write out the code for a click event for all 90 labels. Thanks for your time. :sign0085:
klaus Expert Licensed User Longtime User Nov 24, 2011 #2 How do you create your labels ? The name has no importance, what yo need is: - to Dim each label - initialize each label with the SAME event name for all labels - set a different Tag property for each label, allowing to know what Label eaised the Click event. You find an example of a keyboard with buttons sharing the same click event in chapter 3 Second program in the Beginner's Guide. Best regards. Upvote 0
How do you create your labels ? The name has no importance, what yo need is: - to Dim each label - initialize each label with the SAME event name for all labels - set a different Tag property for each label, allowing to know what Label eaised the Click event. You find an example of a keyboard with buttons sharing the same click event in chapter 3 Second program in the Beginner's Guide. Best regards.
S skcud Member Nov 24, 2011 #3 Thank you for the response. So I have done what you said and have now set tag values for each of my labels. One of my arrays is YVV(x) and they all have the event name "YVV" So I have started a new sub with: Code: Copy Sub YVV_Click How do I determine the tag value of the label that was clicked? Thanks again. Upvote 0
Thank you for the response. So I have done what you said and have now set tag values for each of my labels. One of my arrays is YVV(x) and they all have the event name "YVV" So I have started a new sub with: Code: Copy Sub YVV_Click How do I determine the tag value of the label that was clicked? Thanks again.
K kickaha Well-Known Member Licensed User Longtime User Nov 24, 2011 #4 You need to use the Sender keyword in your sub - that is a pointer to the object that called the sub: Code: Copy Sub YVV_Click Dim buttonId As String btn = Sender ButtonId = btn.Tag ................. Upvote 0
You need to use the Sender keyword in your sub - that is a pointer to the object that called the sub: Code: Copy Sub YVV_Click Dim buttonId As String btn = Sender ButtonId = btn.Tag .................