Link to home
Start Free TrialLog in
Avatar of Andrew Parker
Andrew ParkerFlag for Australia

asked on

selecting monthcalender date

Morning

I have an app which I need to call the date selected on the monthcalenderpicker, and send this date to a textbox.

'Code so far

        Try
            cmd.Connection.Open()
            dr = cmd.ExecuteReader
            If dr.Read Then
                MsgBox("Employee Skill Combo Exists")
            Else
                If ComboBoxAccRoute.Text = "" Then
                    txtDateChosen.Text = "00/00/00"
                Else
                    txtDateChosen.Text = ExpiryDatePicker.Text
                End If
            End If
        Catch ex As SqlException
            MessageBox.Show(ex.Message)
        Finally
            cmd.Connection.Close()
        End Try
ASKER CERTIFIED SOLUTION
Avatar of 123654789987
123654789987

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Andrew Parker

ASKER

ok, datepicker works better than monthcalender thanks

How do I just have date not time?
Avatar of 123654789987
123654789987

We have the System.windows.Forms.DateTimePicker

which has both date and time
Eg:

Public Sub CreateMyDateTimePicker()
    ' Create a new DateTimePicker control and initialize it.
    Dim dateTimePicker1 As New DateTimePicker()
   
    ' Set the MinDate and MaxDate.
    dateTimePicker1.MinDate = New DateTime(1985, 6, 20)
    dateTimePicker1.MaxDate = DateTime.Today
   
    ' Set the CustomFormat string.
    dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd"
    dateTimePicker1.Format = DateTimePickerFormat.Custom
   
    ' Show the CheckBox and display the control as an up-down control.
    dateTimePicker1.ShowCheckBox = True
    dateTimePicker1.ShowUpDown = True
End Sub 'CreateMyDateTimePicker