halt application flow until condition is met

  • Thread starter googlinggoogler
  • Start date
G

googlinggoogler

Hi,

Sorry for the poor topic name, i couldnt think how to word it any
better.

I have put below my code and I hope this makes what im trying to say,
easier to understand. (I realise that the source isnt correct and won't
work in its current form, its like this for ease of reading.)

Basically start.vb trys to decide whether to continue or not depending
on whether the global variables X and Y are equal to 1. My problem was
that if i didnt put in -

Do Until Accepted.Y = 1

Loop

That the condition would never be met and X would always be equal to 0,
and the program would terminate.

But with this in the program doesnt work correctly, Is there a way to
halt the program until Accepted.Y is equal to Y and then continue to
the IF statement??

I hope you understand my question!

Thanks

David


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''start1.vb'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Module startup

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



Public Sub main()

Do Until Accepted.Y = 1

Loop


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

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


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''registration.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

More specifically I would suggest something similar to :

Public Sub main()
Register.ShowDialog
If Register.DialogResult=DialogResult.OK Then
Application.Run(frmapplication)
End If
End Sub

Private Sub Continue_Click() Handles Continue.Click
If validate() = true then
DialogResult=DialogResult.Ok
Close
Else
MsgBox("Invalid Registration Key", MsgBoxStyle.Critical, "
End If
End Sub

--
 

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