CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2005
    Posts
    116

    How to clear DTPicker

    hi friends .

    i have tow DTPicker in the form using them to search for date by date
    so how to clear them when i want to make another search

    to be
    when Command1_Click()

    DTPicker.value=" "



    thanks

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: How to clear DTPicker


  3. #3
    Join Date
    Oct 2005
    Posts
    116

    Re: How to clear DTPicker

    HI THERE

    thanks i got it .

    but when i want to say

    if DTPicker1.value="" then

    msgbox"*****"
    else if DTPicker1.value<>"" then

    msgbox"++++++"


    just and example

    actually i want to use to retrive date from databas in more than one choice.

  4. #4
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: How to clear DTPicker

    Sorry, I am not able to understand what is your requirement?
    Can you explain a bit more.

  5. #5
    Join Date
    Oct 2005
    Posts
    116

    Re: How to clear DTPicker

    thanks

    i use this code that u give it working ok

    Private Sub DTPicker1_Change()
    DTPicker1.Format = dtpCustom
    DTPicker1.CustomFormat = "dd-MM-yyyy"
    End Sub

    now i want to display massage

    when i say

    IF DTPicker1="" then
    msgbox " hi!!"
    elseif DTPicker.value <>"" then
    msgbox " hello"

    the proplem here it show me only one massage in both when DTPicker<>""
    and DTPicker.value=""
    so what is the problem here

    hope that u understand what i mean

    thanks

  6. #6
    Join Date
    Nov 2005
    Posts
    17

    Exclamation Re: How to clear DTPicker

    Quote Originally Posted by hussein2000
    thanks

    i use this code that u give it working ok

    Private Sub DTPicker1_Change()
    DTPicker1.Format = dtpCustom
    DTPicker1.CustomFormat = "dd-MM-yyyy"
    End Sub

    now i want to display massage

    when i say

    IF DTPicker1="" then
    msgbox " hi!!"
    elseif DTPicker.value <>"" then
    msgbox " hello"

    the proplem here it show me only one massage in both when DTPicker<>""
    and DTPicker.value=""
    so what is the problem here

    hope that u understand what i mean

    thanks
    I struggeled for a long time with that. I used two different ways around it. In a simple case use the checkbox option in the datetimepicker. In a more complex case I had to place a text box on top of the dtpicker. Both controls are linked to the same field in the table.
    Hope this help.
    <jacom@dme.ae> or <jaco@emirates.net.ae>

  7. #7
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: How to clear DTPicker

    If I had to check the value of the DTPicker against null then I would use a Checkbox, like I have written in the link that I provided. You need to set the CheckBox property of the DTPicker to true. This will display a CheckBox in the DTPicker. If the checkbox is unchecked then that means the value in the DTPicker is null.
    Code:
    Private Sub Form_Load()
        DTPicker1.CheckBox = True
    End Sub
    And someting like this to check thevalue
    Code:
        If IsNull(DTPicker1.Value) Then
            MsgBox "Value in DTPicker is Null"
        Else
            MsgBox "Value in DTPicker is not null"
        End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured