We help IT Professionals succeed at work.

selecting monthcalender date

Andrew Parker
on
Medium Priority
309 Views
Last Modified: 2010-04-23
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
Comment
Watch Question

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


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Andrew ParkerIT Field Systems Delivery Officer

Author

Commented:
ok, datepicker works better than monthcalender thanks

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

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.