Popup Panel on custom control does not appear - any ideas?
-
I have a VB.Net 2.0 custom control which allows me to pick a date and a 24 hour time. The control consists of a standard DateTimePicker to select the date and for the 24 hour time a textbox (txtHours) to display the selected hour, a label (lblSelectHours) which consists of an image of the standard dropdown icon and a Panel object. When the user clicks on the dropdown label the Panel, containing one button for each of the 24 hours in a day, should pop up. However, the panel is nowhere to be seen even though I know the label's Click event is firing. I am pretty puzzled about this as the popup panel for the standard DateTimePicker in the control appears perfectly. The Panel object is defined in the control as being off the main area being displayed but when the user clicks the dropdown arrow (the label) the event handler below should set the correct position to appear and set Visible to true:
Private Sub lblSelectHours_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSelectHours.Click pnlHours.Left = Me.Left + txtHours.Left pnlHours.Top = Me.Top + txtHours.Top + txtHours.Height pnlHours.Visible = True pnlHours.BringToFront() End Sub
So does anyone know why my popup panel won't appear? If I copy the various components of the control and just put them on a form (ie: without the use of a custom control) the panel appears fine with this same code. TIA for any help... Mike -
I have a VB.Net 2.0 custom control which allows me to pick a date and a 24 hour time. The control consists of a standard DateTimePicker to select the date and for the 24 hour time a textbox (txtHours) to display the selected hour, a label (lblSelectHours) which consists of an image of the standard dropdown icon and a Panel object. When the user clicks on the dropdown label the Panel, containing one button for each of the 24 hours in a day, should pop up. However, the panel is nowhere to be seen even though I know the label's Click event is firing. I am pretty puzzled about this as the popup panel for the standard DateTimePicker in the control appears perfectly. The Panel object is defined in the control as being off the main area being displayed but when the user clicks the dropdown arrow (the label) the event handler below should set the correct position to appear and set Visible to true:
Private Sub lblSelectHours_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblSelectHours.Click pnlHours.Left = Me.Left + txtHours.Left pnlHours.Top = Me.Top + txtHours.Top + txtHours.Height pnlHours.Visible = True pnlHours.BringToFront() End Sub
So does anyone know why my popup panel won't appear? If I copy the various components of the control and just put them on a form (ie: without the use of a custom control) the panel appears fine with this same code. TIA for any help... MikeI am surprised to see Left+Left and Top+Top maybe your coordinates are way off ? :)
Luc Pattyn