Martin Brading Posted April 8, 2004 Posted April 8, 2004 (edited) I have created an enhanced combo box (user control) which is placed on a form. Any events that are common to both the usercontrol and combobox (in usercontrol) such as "_Validated" fire ok both in the usercontrol itself and the form which the user control sits. However, the "_dropdown" event (which is only within the combobox itself and not by default a standard event in the user control) fires ok in the user control BUT DOESN'T fire in the Form, even though that form has a "_dropdown" event. Any reason why ? I'm sure this is 101 stuff, but I can't find the issue. Edited April 9, 2004 by Martin Brading Quote
mooman_fl Posted April 10, 2004 Posted April 10, 2004 However' date=' the "_dropdown" event (which is only within the combobox itself and not by default a standard event in the user control) fires ok in the user control BUT DOESN'T fire in the Form, even though that form has a "_dropdown" event.[/quote'] Show some code. How do you have the event declared in the usercontrol? Is the event declared as public? Quote "Programmers are tools for converting caffeine into code." Madcow Inventions -- Software for the Sanity Challenged.
*Experts* DiverDan Posted April 10, 2004 *Experts* Posted April 10, 2004 Did you remember to include MyBase.OnDropDown(e) in the user control's Protected Overrides Sub OnDropDown event? as an example... 'adjust dropdown width to largest item width Protected Overrides Sub OnDropDown(ByVal e As System.EventArgs) MyBase.OnDropDown(e) Dim i As Integer Dim itemSize As Drawing.SizeF If Me.Items.Count >= 1 Then Dim g As Graphics = Me.CreateGraphics For i = 0 To Me.Items.Count - 1 itemSize = g.MeasureString(Me.Items.Item(i).ToString, Me.Font) If itemSize.Width > Me.DropDownWidth Then Me.DropDownWidth = itemSize.Width End If Next g.Dispose() End If End Sub Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.