DateTimpicker Jumping position

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • WazzaRoberts
    New Member
    • May 2007
    • 9

    DateTimpicker Jumping position

    I currently have a datetimepicker on a form and a sepertae check box next to it. the dtp is not enabled. When the check box is ticked the dtp becomes enabled, now here lies my problem, when i click the check box to enable the dtp it does enable but it jumps from its position on the form upto the top left corner. If i then click the checkbox again the dtp returns to its original position and is disabled. Here is my code

    'if checkbox ticked then enable the datetimepicker
    If chkEndDate.Valu e = 0 Then
    dtpEndDate.Enab led = False
    ElseIf chkEndDate.Valu e = -1 Then
    dtpEndDate.Enab led = True
    End If

    Any help would be much appreciated.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    I don't know what causes this, but as a workaround (hopefully temporary) you could try explicitly moving it into position after enabling it. Or perhaps hide it, enable it, then show it. In other words...

    [CODE=vb]' If checkbox ticked then enable the datetimepicker
    If chkEndDate.Valu e Then
    dtpEndDate.Visi ble = False
    dtpEndDate.Enab led = True
    dtpEndDate.Visi ble = True
    Else
    dtpEndDate.Enab led = False
    End If[/CODE]I have no idea whether this will help, of course.

    Comment

    • umeshj99
      New Member
      • May 2007
      • 11

      #3
      Originally posted by WazzaRoberts
      I currently have a datetimepicker on a form and a sepertae check box next to it. the dtp is not enabled. When the check box is ticked the dtp becomes enabled, now here lies my problem, when i click the check box to enable the dtp it does enable but it jumps from its position on the form upto the top left corner. If i then click the checkbox again the dtp returns to its original position and is disabled. Here is my code

      'if checkbox ticked then enable the datetimepicker
      If chkEndDate.Valu e = 0 Then
      dtpEndDate.Enab led = False
      ElseIf chkEndDate.Valu e = -1 Then
      dtpEndDate.Enab led = True
      End If

      Any help would be much appreciated.

      Normally a control on form won't move unless you have specified some code to do so. Just check whether you have given any code to set topcoordinate, leftcoordinate etc. of the datetimepicker control, or whether you have used
      dtpEndDate.move , which may be getting executed when you click the checkbox or when the datetimepicker control is enabled/disabled.

      Comment

      • WazzaRoberts
        New Member
        • May 2007
        • 9

        #4
        I have no code other for moving it other than that listed above.

        Killer thanks for that as it is now working, albeit in a work around fasion.

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by WazzaRoberts
          I have no code other for moving it other than that listed above.

          Killer thanks for that as it is now working, albeit in a work around fasion.
          What version of VB is this? I think I ran into a similar problem in VBA under MS Access some time ago. Don't think I ever found a solution, but I didn't look very hard, as it wasn't a real application I was working on anyway.

          Comment

          Working...