• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

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
0
Andrew Parker
Asked:
Andrew Parker
  • 2
1 Solution
 
123654789987Commented:
If u want to send a selected date to the textbox. u can do this in the click event of the datepicker

Private Sub MyDatePicker_Click(ByVal sender As Object, ByVal e As DragEventArgs) Handles MyDatePicker.Click
  Textbox1.text = MyDatePicker.value
End Sub


0
 
Andrew ParkerIT Field Systems Delivery OfficerAuthor Commented:
ok, datepicker works better than monthcalender thanks

How do I just have date not time?
0
 
123654789987Commented:
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

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now