C
Co
Marco,
You can set the name of a textbox to another name, however that does not
change the reference to that texbox object.
In other words, you don't make it dynamic like that.
When you want to use it a little bit more dynamic then look at that samples
I have given you some time ago but it did not fit you then (it was for
another reason)
Dim TextBoxes as Textbox() = {Textbox1,Textbo2 tot 6 }
Now you can use it dynamically by just using the TextBoxes with its number
from 0 to 5
Cor
I worked it out.
Dim sDateBox As TextBox
Private Sub tbVerlooptTot_DoubleClick(ByVal sender As Object, ByVal e
As System.EventArgs) Handles tbVerlooptTot.DoubleClick
If bCalOpened = False Then
sDateBox = tbVerlooptTot
CreateDTP()
End If
Private Sub CreateDTP()
bCalOpened = True
m_picker = New MonthCalendar
m_picker.BringToFront()
m_picker.MaxSelectionCount = 1
m_picker.Size = tbVerlooptTot.Size
m_picker.BackColor = Color.Beige
tbVerlooptTot.Parent = Me
Me.Controls.Add(m_picker)
m_picker.BringToFront()
m_picker.Select()
End Sub
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 t As TextBox = DirectCast(sDateBox, TextBox)
'Display the Start and End property values of
'the SelectionRange object in the text boxes.
t.Text = m_picker.SelectionRange.Start.Date.ToShortDateString
()
t.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()
Me.Controls.Remove(m_picker)
m_picker = Nothing
bCalOpened = False
End If
End Sub
Thanks for helping me in the right direction.
Marco