2 Replies - 2592 Views - Last Post: 05 December 2008 - 06:28 AM Rate Topic: -----

#1 siriusfire   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-December 08

VB6 Only loading one 'child' form at a time during loop

Post icon  Posted 04 December 2008 - 06:38 PM

Hi,

I'm fairly new to VB6 so you may have to bear with me!

I'm trying to create a loop where one to five of five 'sub-forms' will load individually but in a random order - ie only one at a time. I have managed to create an array with the order that the sheets should load,( Final() ) and have used the following code to load the sub-forms. The only problem I have is that all the forms load at once. I want it to be so that only one form will load at a time and the next one will be visible once the previous form has been 'completed'. 'Numb' is the number of forms that have been selected to be shown - from 1 - 5

Is there any way to stop the for - next loop while the other form can be seen?

Thanks in anticipation.

SF

For L = 1 To Numb
	If final(L) = 1 Then
		FORMONE.Show
		Unload Me
	End If
	If final(L) = 2 Then
		FORMTWO.Show
		Unload Me
	End If
	If final(L) = 3 Then
		FORMTHREE.Show
		Unload Me
	End If
	If final(L) = 4 Then
		FORMFOUR.Show
		Unload Me
	End If
	If final(L) = 5 Then
		FORMFIVE.Show
		Unload Me
	End If
Next L


This post has been edited by siriusfire: 04 December 2008 - 06:41 PM


Is This A Good Question/Topic? 0
  • +

Replies To: VB6 Only loading one 'child' form at a time during loop

#2 born2c0de   User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 187
  • View blog
  • Posts: 4,673
  • Joined: 26-November 04

Re: VB6 Only loading one 'child' form at a time during loop

Posted 04 December 2008 - 11:22 PM

Display the Forms Modally like this:
For L = 1 To Numb
    If final(L) = 1 Then
        FORMONE.Show vbModal
        Unload Me
    End If
    If final(L) = 2 Then
        FORMTWO.Show vbModal
        Unload Me
    End If
    If final(L) = 3 Then
        FORMTHREE.Show vbModal
        Unload Me
    End If
    If final(L) = 4 Then
        FORMFOUR.Show vbModal
        Unload Me
    End If
    If final(L) = 5 Then
        FORMFIVE.Show vbModal
        Unload Me
    End If
Next L

Hope this helps :)
Was This Post Helpful? 0
  • +
  • -

#3 siriusfire   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-December 08

Re: VB6 Only loading one 'child' form at a time during loop

Posted 05 December 2008 - 06:28 AM

Thank you very much indeed - perfect!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1