Form taking for ever to load

ox0069

Registered User.
Local time
Today, 17:30
Joined
Sep 14, 2004
Messages
11
I have a form that fills out 124 control boxes with names and then colors them based on the grouping. I'm basically creating a seating chart.

I'm runing into a problem that after the 2nd or 3rd time Load the form, it starts to take 5is minuts to run thru the code to format the chart.

I've don the trick of copying all the controls into a new form and renaming the new form the old forms name, but again after the 4th or 5th time of loading the form, ith starts to lag greatly. below is the code that populates the text boxes with the names and the colors:

~~~~~~~~~~~~~~~~~~~~~~~~~~
For seatnum = 0 To List2.ListCount - 1

Me("seat" & seatnum) = List2.ItemData(seatnum)

List2.BoundColumn = 4
redcolorfill = List2.ItemData(seatnum)
List2.BoundColumn = 5
greencolorfill = List2.ItemData(seatnum)
List2.BoundColumn = 6
bluecolorfill = List2.ItemData(seatnum)

List2.BoundColumn = 7
redicolorfill = List2.ItemData(seatnum)
List2.BoundColumn = 8
greenicolorfill = List2.ItemData(seatnum)
List2.BoundColumn = 9
blueicolorfill = List2.ItemData(seatnum)

If Me("seat" & seatnum).BackColor <> RGB(redcolorfill, greencolorfill, bluecolorfill) Then
Me("seat" & seatnum).BackColor = RGB(redcolorfill, greencolorfill, bluecolorfill)
End If

If Me("seat" & seatnum).ForeColor <> RGB(redicolorfill, greenicolorfill, blueicolorfill) Then
Me("seat" & seatnum).ForeColor = RGB(redicolorfill, greenicolorfill, blueicolorfill)
End If
List2.BoundColumn = 3
Next seatnum
For seatnum = 0 To List3.ListCount - 1

Me("grp" & seatnum) = List3.ItemData(seatnum)

List3.BoundColumn = 3
redcolorfill = List3.ItemData(seatnum)
List3.BoundColumn = 4
greencolorfill = List3.ItemData(seatnum)
List3.BoundColumn = 5
bluecolorfill = List3.ItemData(seatnum)

List3.BoundColumn = 6
redicolorfill = List3.ItemData(seatnum)
List3.BoundColumn = 7
greenicolorfill = List3.ItemData(seatnum)
List3.BoundColumn = 8
blueicolorfill = List3.ItemData(seatnum)


Me("grp" & seatnum).BackColor = RGB(redcolorfill, greencolorfill, bluecolorfill)
Me("grp" & seatnum).ForeColor = RGB(redicolorfill, greenicolorfill, blueicolorfill)
Me("grp" & seatnum).BorderColor = RGB(0, 0, 0)

List3.BoundColumn = 2
Next seatnum
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Any help or advice would be apreciated
 
Why don you need to keep changing the bound column when you cab refer to the column in code

redcolorfill = List2.Column(seatnum,4)
greencolorfill = List2.Column(seatnum,5)
etc.

where seatnum is the index and 4 is the column. remember that columns are zero based.

Also remove the If statements and let it repaint the color anyway even if it is the same.
 

Users who are viewing this thread

Back
Top Bottom