Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hi. Could someone please look at the below for me? I have rewritten it from my actual code to make it a better example of what i am trying to do.

 

'This is called every second, I will nearly always be 1
For i to 100
 If i <> 1 Then
   Dim OtherForm As New  FrmOtherForm
   OtherForm.Text = Str(i)
   OtherForm.Show()

   'If returned value then do something, else do something else
 ENDIF
Next i

 

I would like to somehow return a value from each occurence of OtherForm and not proceed with the loop until the other form has been closed - and the value returned. I certainly want to stop multiple forms being launched simultaneously.

 

Could someone please point me in the right direction?

 

Thanks.

Edited by Jay1b
Posted

Thanks yet again.

 

The ShowDialog works beautifully for returning a value, but it doesnt stop the code from continueing until a value has been returned. So i still get multiple forms appearing.

 

Imagine a firewall, when you first install it you get unindated with 'Do you wish to allow ****.exe to access the internet?' screens. Then after its been installed a few weeks you barely get any of these screens, this will work on the same principle.

Posted

Argh..... Just had a thought, this piece of code is being called every second by the timer. So the ShowDialog is blocking the rest of the code, but the timer is creating a new instance of that code every second. I've checked this and can confirm thats whats happening :)

 

Thanks.

  • *Experts*
Posted

I didn't see a question in that last post...

As P said, why not tell us what you're trying to do rather than what you're doing (and it sure seems odd, whatever it is).

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

There wasnt suppose to be a question. The post was aimed purely at saying thank you. :D

 

Yes it is rather different, its something i am seriously thinking about releasing, or selling to someone who could write it properly and let them sell it :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...