DateTimePicker

Started by jermy, May 05, 2020, 12:22:57 PM

Previous topic - Next topic

jermy

Hi Paul,

DateTimePicker does not always completely change to the correct format


''
''
Function frmMain_Button1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT

frmMain.DateTimePicker1.DateFormat = DateTimePickerFormat.TimeFormat   'does not completely change to the correct format

   Function = 0
End Function

''
''
Function frmMain_Initialize( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT

   With frmMain.DateTimePicker1
       ''   .DateFormat = DateTimePickerFormat.TimeFormat  'changes completely to the correct format
          .Enabled = False
          .SelectedTime = AfxStrRemoveAnyI(TIME, ":") 
   end with

   Function = 0
End Function


it's not a problem, I just noticed.


Paul Squires

Hi jermy, I am not seeing what the problem is, or I am not following what it is you are observing.
You may need to guide me through this one a little more. When I press Button1 the DateTimePicker control seems to correctly stay in the TimeFormat format.
Paul Squires
PlanetSquires Software

jermy

Hi Paul,

I have added an example, when I click on the button I have a date time picker in time format with a calendar.
This behavior is different when you place the change command in frmMain_Initialize.

Paul Squires

ahhh, okay, now I understand. When changing to TimeFormat obviously we want Updown buttons instead of dropdown calendar. I'll fix that.
Paul Squires
PlanetSquires Software

jermy

Tnx Paul,

Just experienced, FormWindowState.Maximized and FormWindowState.Normal work the other way around


' frmMain form code file

''
''
Function frmMain_Button1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT

    frmMain.WindowState = FormWindowState.Maximized  'frmMain goes to normal state

   Function = 0
End Function

''
''
Function frmMain_Button2_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT

    frmMain.WindowState = FormWindowState.Normal  'frmMain goes to maximized state

   Function = 0
End Function

''
''
Function frmMain_Initialize( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT

    frmMain.Button1.Text = "Maximized"
    frmMain.Button2.Text = "Normal"
   
   Function = 0
End Function
'FormWindowState.Minimized works as expected




Paul Squires

Thanks - that was a small typo. Got it fixed now.
Paul Squires
PlanetSquires Software