halt application flow until condition is met

  • Thread starter googlinggoogler
  • Start date
G

googlinggoogler

Hi,

I've posted my code to try and explain myself better, although its not
correct and i realise this cos i've chopped bits out to make things
easier to read.

Basically in start.vb, frmapplication should only open when the
conditions X and Y are 1.

So i tried to wait for Y to be 1 before proceeding to X, by means of a
DO UNTIL Y = 1, but this doesnt seem to work and causes the program to
crash.

can anyone suggest a better way of doing this?? all I want to do is
halt the flow of sub main() until Y = 1. is there a means to halt in
VB.net? or a better way of doing this??

Thanks

David


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''start.vb'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Module startup

Public Class Accepted
Public Shared Y As Integer
Public Shared X As Integer
End Class



Public Sub main()


register.Show()
Do Until Accepted.Y = 1

Loop


If Accepted.X = 1 Then
register.Close()
Application.Run(frmapplication)
Else
MsgBox("Invalid Registration Key", MsgBoxStyle.Critical,
" ")
End If
End Sub

End Module
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''register.vb'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Public Class B

Private Sub Continue_Click() Handles Continue.Click

If validate() = true then
Accepted.Y = 1
Accepted.X = 1
Else
MsgBox("Invalid Registration Key", MsgBoxStyle.Critical, "
")
End If

End Sub

end Class


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
P

Patrice

I would look at ShowModalDialog. Is this what you are trying to do ?
(i.e.the control flow is back to the line that follows ShowModalDialog only
once the dialog is closed).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top