Calendar event

Discussion in 'Questions (Windows Mobile)' started by Rioven, Aug 23, 2007.

  1. Rioven

    Rioven Active Member Licensed User

    Hi,
    I have attached a code using calendar function.
    Once the date value was selected for the first time it will assign to textbox, delete value of textbox then pick again same date, obviously nothing will happen because value was not changed on 'valuechanged' event. If I use the 'close' event the textbox get automatically the value from calendar even without selecting it, which I don't want to do.
    The calendar don't have 'click' event for the value then how can I re-initialized it same as when it first use?

    thanks & regards,
    rioven
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you further explain what are you trying to achieve?
     
  3. Rioven

    Rioven Active Member Licensed User

    Hi Erel,
    I have a program that a textbox is on top of calendar control in which user can type-in or select date from calendar.

    Once the user use the calendar it will be written on textbox, then if user accidentally erased the date from the textbox he has to take again the same date, therefore the value of calendar remains then the valuechanged event will not work anymore.

    :confused:
     
    Last edited: Aug 23, 2007
  4. specci48

    specci48 Well-Known Member Licensed User

    Hi Rioven,

    replace
    Code:
    Sub Calendar1_ValueChanged
    with
    Code:
    Sub Calendar1_Close
    The second event is fired even the user hasn't changed the date.


    specci48
     
  5. Rioven

    Rioven Active Member Licensed User

    Hi specci48,
    My concern on using 'close' event is once the user have already an input on textbox and accidentally pressed the calendar then the date he has already inputed will be overwritten.:(
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Maybe you could use the Calendar DropDown event to update the date:
    Sub Calendar1_DropDown
    calendar1.Value = DateParse(textBox1.Text)
    End Sub
     
  7. Rioven

    Rioven Active Member Licensed User

    Hi Erel,
    DateParse works on "mm/dd/yyyy" date format only.
    I'll try some workaround..
    thanks again!
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    You can choose which format to use:
    Code:
    Sub App_Start
     DateFormat(
    "dd/mm/yyyy")
    End Sub

    Sub Calendar1_DropDown
     calendar1.Value = DateParse(textBox1.Text)
    End Sub
     
Loading...