Home All Groups Group Topic Archive Search About

halt application flow until condition is met

Author
6 Feb 2006 7:02 PM
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


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Author
6 Feb 2006 7:18 PM
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

--

<googlinggoog***@hotmail.com> a écrit dans le message de
Show quoteHide quote
news:1139250896.902002.304830@g47g2000cwa.googlegroups.com...
> 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
>
>
>
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''
>