hicksi
Board Regular
- Joined
- Mar 5, 2012
- Messages
- 203
Hi,
I believe that my problem can be solved by an Events Class, but...
The problem that I have is that I have a variable number of rooms (specified in an Excel sheet), with a Morning and Afternoon booking. By default, when someone allocates a room, it gets pre-filled with 08:00 or 13:00.
The screen will show a textbox for each of the unallocated rooms. So there could be up to 5*2*number-of-rooms. This I achieve by dynamically adding the textbox in the "correct" position on the Userform.
What I want to achieve is to have the user click in the required textbox, have it pre-fill with the default, and then also validate the value when exiting the textbox to be a valid time and within range.
Currently, pseudo-code is like:
SO... My question is how do I supply Events to each of these TextBoxes?
I believe that my problem can be solved by an Events Class, but...
The problem that I have is that I have a variable number of rooms (specified in an Excel sheet), with a Morning and Afternoon booking. By default, when someone allocates a room, it gets pre-filled with 08:00 or 13:00.
The screen will show a textbox for each of the unallocated rooms. So there could be up to 5*2*number-of-rooms. This I achieve by dynamically adding the textbox in the "correct" position on the Userform.
What I want to achieve is to have the user click in the required textbox, have it pre-fill with the default, and then also validate the value when exiting the textbox to be a valid time and within range.
Currently, pseudo-code is like:
VBA Code:
For each Room
Determine .Top value
Display Room Label
For each Day
Determine .Left value
For each Session
Add offset to .Left
If session-not-allocated then
Set objTxt = Frame.Controls.Add("Forms.TextBox.1")
With objTxt
.Top = iTop
.Left = iLeft
.Width = 46
.Tag = Identifiable Tag
.Visible = True
End With
Endif
Next
Next
Next
SO... My question is how do I supply Events to each of these TextBoxes?