home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,156 of 10,840   
   Steve Gerrard to Rick Rothstein   
   Re: User Interface advice   
   06 Aug 06 10:01:54   
   
   From: mynamehere@comcast.net   
      
   "Rick Rothstein"  wrote in message   
   news:1bCdnUbMqdvXn0vZnZ2dnUVZ_vqdnZ2d@comcast.com...   
   >> I have a user form with a date picker associated to a database. The date   
   >> picker has a meeting date, however, not every record has this date set (i.e.   
   >> some record has no meeting date).   
   >>   
   >> Unfortunately, the date picker when not set to any particular date, would   
   >> display whatever date the control was created. Even when the control is   
   >> disabled, this shows. I can't find a way to make this control "blank".   
   >>   
   >   
   > I'm not sure what you mean by "a date picker associated to a database"... if   
   > you mean it is bound to a database, then I am not sure if the following can   
   be   
   > made to work or not (I never bind controls to databases directly); however,   
   if   
   > you are interrogating the database and then attempting to set the initial   
   > display in the DatePicker control, then you can definitely make use of the   
   > following...   
      
   > (code snipped)   
      
   Same idea, different arrangement. This one might work better for a data-bound   
   date picker, since it does not need a call to "FormatDTPicker"; it will work   
   off   
   of the built in format events. Note that the keyboard shortcuts for changing   
   the   
   date won't work, however.   
      
   Const PickerFormat As String = "MMM dd, yyyy"   
      
   Private Sub Form_Load()   
       DTPicker1.CheckBox = True   
       DTPicker1.CustomFormat = "X"   
       DTPicker1.Format = dtpCustom   
   End Sub   
      
   Private Sub DTPicker1_Format(ByVal CallbackField As String, FormattedString As   
   String)   
       FormattedString = GetDateString(DTPicker1)   
   End Sub   
      
   Private Sub DTPicker1_FormatSize(ByVal CallbackField As String, Size As   
   Integer)   
       Size = Len(PickerFormat)   
   End Sub   
      
   Private Function GetDateString(Picker As DTPicker) As String   
       With Picker   
           If IsNull(.Value) Then   
               GetDateString = ""   
           Else   
               GetDateString = Format(.Value, PickerFormat)   
           End If   
       End With   
   End Function   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca