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("SURNAME = '" & sSURNAME
& "'AND FORENAME = '" & sFORENAME & "'")(0)
Else
dROp = dsPUPILS.Tables(0).Select("SURNAME = '" & 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(dayINDEX, periodINDEX).BackColor =
System.Drawing.SystemColors.Window
If dayINDEX = Weekday(Now) Then
If dtTIMES(dayINDEX, periodINDEX) <
CDate(TimeString) 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("PERIOD = " &
periodINDEX)
If dRO.GetUpperBound(0) < 0 Then ' not a break - add
the field
sCrit = dROp("P" & dayINDEX.ToString &
(Format(iPerInc, "00").ToString))
txtDISPLAY(dayINDEX, periodINDEX).Text = sCrit
iPerInc += 1
Else
'it is a break - Populate with break type
For Each Row In dRO
If Row(1) = "B" Then
txtDISPLAY(dayINDEX, periodINDEX).Text =
"BREAK"
ElseIf Row(1) = "L" Then
txtDISPLAY(dayINDEX, periodINDEX).Text =
"LUNCH"
ElseIf Row(1) = "R" Then
txtDISPLAY(dayINDEX, periodINDEX).Text =
"REGISTRATION"
End If
Next
End If
System.Windows.Forms.Application.DoEvents()
Next periodINDEX
Next dayINDEX
txtDISPLAY(Weekday(Now) - 1, iCurrentPeriod).BackColor =
System.Drawing.Color.Yellow
Call LockCells()
End Sub