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,155 of 10,840   
   Rick Rothstein to All   
   Re: User Interface advice   
   06 Aug 06 10:52:58   
   
   From: rickNOSPAMnews@NOSPAMcomcast.net   
      
   >I am looking for some advise on user interface related to the date picker   
   > control.   
   >   
   > 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 have use a regular text box and move the date into it but it becomes   
   > cumbersome code-wise when you have multiple date pickers on the screen.   
   >   
   > Would anyone have a suggestion how to handle this?   
      
   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...   
      
   From a previous post of mine...   
      
   Put the code which appears after my name in the Form's code window and see   
   if it does what you want. When you want to blank the DatePicker control   
   within code, say using a CommandButton, put this in its Click event.   
      
        Private Sub Command1_Click()   
          DTPicker1.Value = vbNull   
          FormatDTPicker   
        End Sub   
      
   Once you execute the above, the text field for the DatePicker control will   
   be blanked out; however, the drop-down calendar will still display today's   
   date when dropped down (there is no way to "blank" the monthly display that   
   I know of).   
      
   Rick   
      
   '  Place the following code into the form's code window   
   '   
   Private Sub DTPicker1_CloseUp()   
     FormatDTPicker   
   End Sub   
      
   Private Sub DTPicker1_Format(ByVal CallbackField As String, _   
                                    FormattedString As String)   
     If CallbackField = "X" Then   
       FormattedString = ""   
     End If   
   End Sub   
      
   Private Sub FormatDTPicker()   
     With DTPicker1   
       If .Value = vbNull Then   
         .Format = dtpCustom   
         .CustomFormat = "X"   
       Else   
         .Format = dtpShortDate   
       End If   
     End With   
   End Sub   
      
   Private Sub DTPicker1_MouseDown(Button As Integer, _   
                    Shift As Integer, X As Single, Y As Single)   
     With DTPicker1   
       If .Value = vbNull Then   
         .Value = Now   
       End If   
     End With   
   End Sub   
      
   --- 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