Link to home
Start Free TrialLog in
Avatar of vmandem
vmandem

asked on

passing dates from the calender to text box

I have a calendar control on the form by name MonthCalendar1

I have two text boxes. I'm trying to pass two dates like start and end date into the text boxes 1 and 2. For that I did like this

Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged
        txtstartdate.Text = MonthCalendar1.SelectionStart
        txtenddate.text = MonthCalendar1.Selectionend
end sub

BUT WHEN I SELECT THE FIRST TIME IT COPIES TO BOTH TEXTBOXES. HOW TO GET THE SECOND SELECTION DATE TO SECOND TEXTBOX.

Thanks
VM
Avatar of Brian Crowe
Brian Crowe
Flag of United States of America image

try using the DateSelected event instead

"This event is similar to DateChanged, but it occurs at the end of a date selection made using the mouse. The DateChanged event occurs during any date selection, whether by mouse, keyboard, or code."
Avatar of vmandem
vmandem

ASKER

BriCrowe,

It does the same. No change

VM
I just use two calendar controls.  One for the start date, and one for the end date.
ASKER CERTIFIED SOLUTION
Avatar of Brian Crowe
Brian Crowe
Flag of United States of America image

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 vmandem

ASKER

BriCrowe

This one works fine, what If I want to change the firstdate through the calender. The above code changes only for second date. I'm disabling the textboxes for the users to edit and choose only from calendar.

Thanks
VM