Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Wait to return a result in a function

$
0
0

Hello, I am having a few problems with this and I am wondering if this is even possible.

I want to have a function that waits to return its result until a button is pressed.
Let me make an example:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If ShowModalPopBox("Please help me") = 1 Then
            !something(here)
        End If
    End Sub

    Function ShowModalPopBox(ByVal title As String) As Integer
        !displays a modal popup, works fine
        !wait until a button on the modal popup has been pressed
        Return (1)
    End Function

The problem is with the wait, I have tried:
Making a boolean, when the button in the show modal popup has been pressed it sets a value and then using a Do While to wait until the boolean has changed, this did not work.

Then I have tried using WaitHandle.WaitOne Method with no success, it does not wait.

I have multiple buttons so I need it to work this way, by returning an value when a button had been pressed and I would like to call it the way I described in the Button1_Click.
What I am asking about is: How do I wait for a result and pause a return value until it has something to return.

I am trying to recreate the Message box from system.forms.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>