C
Co
Hi All,
I use following code to update a textbox when a date has been chosen
from my MonthCalendar.
Since 6 textboxes use the same MonthCalendar I need to tell him which
textbox was used.
Therefore I have the variable: sWhichDateBox.
How can I use that string to become the name of a textbox:
SelectedTextBox.Text =
m_picker.SelectionRange.Start.Date.ToShortDateString()
Private Sub m_picker_DateChanged(ByVal sender As Object, _
ByVal e As DateRangeEventArgs) Handles m_picker.DateChanged
Dim hti As MonthCalendar.HitTestInfo = m_picker.HitTest
(m_picker.PointToClient(MousePosition))
Dim SelectedTextBox As TextBox = Nothing
SelectedTextBox.Name = sWhichDateBox
'Display the Start and End property values of
'the SelectionRange object in the text boxes.
SelectedTextBox.Text =
m_picker.SelectionRange.Start.Date.ToShortDateString()
SelectedTextBox.Text =
m_picker.SelectionRange.End.Date.ToShortDateString()
'if we clicked on a date then hide the Calendar
If hti.HitArea = MonthCalendar.HitArea.Date Then
m_picker.Hide()
SelectedTextBox.Parent.Controls.Remove(m_picker)
m_picker = Nothing
bCalOpened = False
End If
End Sub
Regards
Marco
The Netherlands
I use following code to update a textbox when a date has been chosen
from my MonthCalendar.
Since 6 textboxes use the same MonthCalendar I need to tell him which
textbox was used.
Therefore I have the variable: sWhichDateBox.
How can I use that string to become the name of a textbox:
SelectedTextBox.Text =
m_picker.SelectionRange.Start.Date.ToShortDateString()
Private Sub m_picker_DateChanged(ByVal sender As Object, _
ByVal e As DateRangeEventArgs) Handles m_picker.DateChanged
Dim hti As MonthCalendar.HitTestInfo = m_picker.HitTest
(m_picker.PointToClient(MousePosition))
Dim SelectedTextBox As TextBox = Nothing
SelectedTextBox.Name = sWhichDateBox
'Display the Start and End property values of
'the SelectionRange object in the text boxes.
SelectedTextBox.Text =
m_picker.SelectionRange.Start.Date.ToShortDateString()
SelectedTextBox.Text =
m_picker.SelectionRange.End.Date.ToShortDateString()
'if we clicked on a date then hide the Calendar
If hti.HitArea = MonthCalendar.HitArea.Date Then
m_picker.Hide()
SelectedTextBox.Parent.Controls.Remove(m_picker)
m_picker = Nothing
bCalOpened = False
End If
End Sub
Regards
Marco
The Netherlands