On Wed, 1 Dec 2004 10:05:30 -0000, "Phil Harvey" <ph***@teamlink .it>
wrote:
Do you really need to be using DoEvents()? Try removing the DoEvents calls.
I could help you better if you provided a more detailed code sample.
I tend to use them when the display need "updating". Question is, this
never happed in vb6, so why does it happen in dotnet?
Friend Sub Populate_Cells( )
Dim iCurrentPeriod As Integer
Dim iPeriodCount As Integer
Dim iPerInc As Integer
Me.Text = sSURNAME & ", " & sFORENAME & " " & sMIDDLE
Me.txtName.Text = sSURNAME & ", " & sFORENAME & " " & sMIDDLE
Me.txtFORM.Text = sFORM
If sMIDDLE = "" Then
dROp = dsPUPILS.Tables (0).Select("SUR NAME = '" & sSURNAME
& "'AND FORENAME = '" & sFORENAME & "'")(0)
Else
dROp = dsPUPILS.Tables (0).Select("SUR NAME = '" & sSURNAME
& "'AND FORENAME = '" & sFORENAME & "' AND MIDDLE = '" & sMIDDLE &
"'")(0)
End If
For dayINDEX = 1 To iNoDays
Select Case dayINDEX
Case 1
iPeriodCount = iMonN
Case 2
iPeriodCount = iTueN
Case 3
iPeriodCount = iWedN
Case 4
iPeriodCount = iThuN
Case 5
iPeriodCount = iFriN
Case 6
If iSatN <> 0 Then
iPeriodCount = iSatN
End If
End Select
iPerInc = 1
For periodINDEX = 1 To iPeriodCount
txtDISPLAY(dayI NDEX, periodINDEX).Ba ckColor =
System.Drawing. SystemColors.Wi ndow
If dayINDEX = Weekday(Now) Then
If dtTIMES(dayINDE X, periodINDEX) <
CDate(TimeStrin g) Then
iCurrentPeriod = periodINDEX
End If
End If
'search through the BREAKS table to see if the current
period is a break
dRO = dsBREAKS.Tables (0).Select("PER IOD = " &
periodINDEX)
If dRO.GetUpperBou nd(0) < 0 Then ' not a break - add
the field
sCrit = dROp("P" & dayINDEX.ToStri ng &
(Format(iPerInc , "00").ToString) )
txtDISPLAY(dayI NDEX, periodINDEX).Te xt = sCrit
iPerInc += 1
Else
'it is a break - Populate with break type
For Each Row In dRO
If Row(1) = "B" Then
txtDISPLAY(dayI NDEX, periodINDEX).Te xt =
"BREAK"
ElseIf Row(1) = "L" Then
txtDISPLAY(dayI NDEX, periodINDEX).Te xt =
"LUNCH"
ElseIf Row(1) = "R" Then
txtDISPLAY(dayI NDEX, periodINDEX).Te xt =
"REGISTRATI ON"
End If
Next
End If
System.Windows. Forms.Applicati on.DoEvents()
Next periodINDEX
Next dayINDEX
txtDISPLAY(Week day(Now) - 1, iCurrentPeriod) .BackColor =
System.Drawing. Color.Yellow
Call LockCells()
End Sub