Say I have 2 list boxes and It is a windows control library. I build it and then include it into my program.
Anyway to get to the listbox events?
Printable View
Say I have 2 list boxes and It is a windows control library. I build it and then include it into my program.
Anyway to get to the listbox events?
have you tried making them public inside the control library?
eg:
in the control library...
then in the form that you have the library added to...VB Code:
[COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Sub[/COLOR] ListBox1_MouseEnter([COLOR=BLUE]ByVal[/COLOR] sender [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Object[/COLOR], [COLOR=BLUE]ByVal[/COLOR] e [COLOR=BLUE]As[/COLOR] System.EventArgs) [COLOR=BLUE]Handles[/COLOR] ListBox1.MouseEnter [COLOR=GREEN]'/// do stuff[/color] [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Sub[/COLOR]
not sure if that helps you.VB Code:
[COLOR=BLUE]Dim[/COLOR] clsLib [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]New[/COLOR] ClassLibrary() [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Sub[/COLOR] Button1_Click([COLOR=BLUE]ByVal[/COLOR] sender [COLOR=BLUE]As[/COLOR] System.Object, [COLOR=BLUE]ByVal[/COLOR] e [COLOR=BLUE]As[/COLOR] System.EventArgs) [COLOR=BLUE]Handles[/COLOR] Button1.Click clsLib.ListBox1.Items.Add("some stuff!") [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Sub[/COLOR]
************************
infact you could set the listbox's Modifiers to Public like this...
Public WithEvents ListBox1 As System.Windows.Forms.ListBox
Yes I made the controls publics but I still cannot access them and Im not even sure how I would since they're not in the drop down boxes at the top like events usually are.Quote:
Originally posted by dynamic_sysop
have you tried making them public inside the control library?infact you could set the listbox's Modifiers to Public like this...
Public WithEvents ListBox1 As System.Windows.Forms.ListBox
If you mean that the the form using your control should access the listbox events and your control is made up of a usercontrol and 2 listboxes then the answer is that you'll need to give your usercontrol the same events and have the 2 child listboxes raise them. With just having the listboxes in the usercontrol then only the usercontrol can receive the events of the listboxes.
Example? I don't know *** you mean :oQuote:
Originally posted by Edneeis
If you mean that the the form using your control should access the listbox events and your control is made up of a usercontrol and 2 listboxes then the answer is that you'll need to give your usercontrol the same events and have the 2 child listboxes raise them. With just having the listboxes in the usercontrol then only the usercontrol can receive the events of the listboxes.