Hi,
I am opening a recordset to read booking times, converting them to twips and storing them in array to display some boxes that represent a timescale.
My current method used below, will display just six boxes.
How can i adapt this to display any number of boxes and of course, reduce the coding. (of course, I could continue to use my method, but not favourable)
I am wondering if I could use some kind of control method to reference the Boxes in this manner: - For A = 1 To NoofBookings
-
'MsgBox TimeSlot(A, 0) & " " & TimeSlot(A, 1) & " " & TimeSlot(A, 2) & " " & TimeSlot(A, 3)
-
Select Case A
-
Case 1
-
box1.Visible = True
-
box1.Left = ((((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9) * 2) + LeftPos)) * tw
-
box1.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
-
box1.Caption = TimeReg(A)
-
-
Case 2
-
Box2.Visible = True
-
Box2.Left = ((((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9) * 2) + LeftPos)) * tw
-
Box2.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
-
Box2.Caption = TimeReg(A)
-
-
Case 3
-
Box3.Visible = True
-
Box3.Left = ((((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9) * 2) + LeftPos)) * tw
-
Box3.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
-
Box3.Caption = TimeReg(A)
-
-
Case 4
-
Box4.Visible = True
-
Box4.Left = ((((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9) * 2) + LeftPos)) * tw
-
Box4.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
-
Box4.Caption = TimeReg(A)
-
-
Case 5
-
Box5.Visible = True
-
Box5.Left = ((((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9) * 2) + LeftPos)) * tw
-
Box5.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
-
Box5.Caption = TimeReg(A)
-
-
Case 6
-
Box6.Visible = True
-
Box6.Left = ((TimeSlot(A, 0) + (TimeSlot(A, 1) / 60) - 9 + LeftPos)) * tw
-
Box6.Width = ((TimeSlot(A, 2) + (TimeSlot(A, 3) / 60))) * tw * 2
-
Box6.Caption = TimeReg(A)
-
-
End Select
-
Next A
-
1 1788 ADezii 8,834
Recognized Expert Expert
Let's assume that you have 10 Text Boxes sequentially numbered Box1 thru Box10. The general Logic for accessing the Properties of these Text Boxes within a single Loop wouold be: - Dim TBox As TextBox
-
Dim intBoxCtr As Integer
-
-
For intBoxCtr = 1 To 10
-
Set TBox = Me.Controls("Box" & CStr(intBoxCtr))
-
TBox.BackColor = QBColor(intBoxCtr)
-
Next
As a side note: - Converting Booking Times to Twips (1/1,440 in.) makes absolutely no sense to me.
- Boxes do not have a Caption Property, and attempting to assign one will generate a Runtime Error.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Shravan |
last post by:
Hi ,
I have a datetimepicker in my application. I am dropping
it down (showing calendar control). When the drop down
window (calendar control) is visible how can I
programmatically closeup the...
|
by: Alex |
last post by:
I'm trying to output a webcontrol in a non-standard way. What I want,
is the page to output xml with the html from the webcontrol in a CDATA
element of the XML document. My code looks something...
|
by: fripper |
last post by:
I have a VB .Net web app and I want to reposition a textbox control on the
webform programmatically. I'm not sure how to do that ... can someone help
please?
Thanks ...
|
by: Paul |
last post by:
I am using Visual Studio.net 2005 (and asp.net 2.0)
Let's say that in a Web Project, I have created a (Dataset?) called
SomeDataset.xsd.
On it I have a TableAdapter called SomeTableTableAdapter...
|
by: Sharon |
last post by:
Hi all,
I'm trying to programmatically render a user control,
but problem is, i don't have the control type
and i cannot use register directive as the context is not an aspx page.
Any ideas,...
| |
by: johnb41 |
last post by:
I want to create a textbox programmatically and add the SAME textbox to
to different panels. This code does not work:
Dim tb As New TextBox
tb.text = "xyz"
Panel1.Controls.Add(tb)...
|
by: Michel Couche |
last post by:
Hello,
I would like to programmatically set the visibility of a selectedWizardStep
after clicking on a button contained in an other one.
I found the following in an article from D. Esposito...
|
by: R.A.F. |
last post by:
Hi,
2 Days ago i wrote a post about "how to add programmatically custom
control on Toolbox".
I'm still blocked with this issue.
Is there someone who did it under C#.NET 2005 and 2008 ?
...
|
by: =?Utf-8?B?QW5nZWw=?= |
last post by:
I seem to understand how the control works as long as I mated to
SqlDataSource or ObjDataSource it works fine. But I do not want to flatten
my design in this manner. I am interested in how I can...
|
by: Just_a_fan |
last post by:
I am adding a bunch of controls with the code below.
Problem 1: When program flow passes to "UpperChanged" when I click it,
the control name is undefined. When I enter:
If udUpperLim1.Value 1...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |