• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

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