Hey guys, does anyone know how to make it to where you can't click on anything while a certain action is being performed?
Printable View
Hey guys, does anyone know how to make it to where you can't click on anything while a certain action is being performed?
You could create a form that is a "please wait" type form, that you show modally, so nothing but the please wait form can be clicked on.
Umm, that freezes the entire application, hence my code never executes.
Code:Me.MousePointer = vbHourglass
WaitForm.Show vbModal, Me 'Me = my calling form, MainForm.
Me.SetFocus
ToField.Text = ""
ToField.Locked = True
ToField.BackColor = vbGray
SubjectField.Text = ""
SubjectField.Locked = True
SubjectField.BackColor = vbGray
EmailBody.Text = ""
If ServerAddress.Text = "" Or Username.Text = "" Or Password.Text = "" Then
MsgBox "You haven't given all the required login information.", vbInformation, "Missing Information"
Exit Sub
End If
StatusCheck.Panels(1).Text = "Attempting to log in..."
FreePOP1.POPHostname = ServerAddress.Text
FreePOP1.POPUsername = Username.Text
FreePOP1.POPPassword = Password.Text
FreePOP1.Connect
If Not FreePOP1.ErrorText = "" Then
GoTo ErrorHandler
Else
StatusCheck.Panels(1).Text = "Success, checking for new messages..."
End If
If FreePOP1.MsgCount > 0 Then
For i = 1 To FreePOP1.MsgCount
FreePOP1.SetCurrentMsg i
StatusCheck.Panels(1).Text = "Retrieving messages, please wait..."
With EmailHistory
.ListItems.Add , , FreePOP1.MsgFrom
.ListItems(i).SubItems(1) = FreePOP1.MsgSubject
.ListItems(i).SubItems(2) = FreePOP1.MsgDate
End With
Next i
StatusCheck.Panels(1).Text = FreePOP1.MsgCount & " new messages, waiting for new commands..."
Else
StatusCheck.Panels(1).Text = "No new messages"
End If
FreePOP1.Disconnect
Me.MousePointer = vbArrow
Unload WaitForm
Exit Sub
ErrorHandler:
Select Case FreePOP1.Error
Case 14
MsgBox "There was a problem connecting to the server." & vbCrLf & "Either your username or password is incorrect.", vbCritical, "Error connecting to server"
Case 15
MsgBox "There was a problem connecting to the server." & vbCrLf & "Either your username or password is incorrect.", vbCritical, "Error connecting to server"
Case Else
MsgBox "Error #" & FreePOP1.Error & ": " & FreePOP1.ErrorText, vbCritical, "Error"
End Select
StatusCheck.Panels(1).Text = "There was an error on the last attempt... #" & FreePOP1.Error & ": " & FreePOP1.ErrorText & "."
Me.MousePointer = vbArrow
Nevermind, I got it. I found I could use a variable to check if the program is busy.