Switch between forms in a vb 6 project

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mohan Krishna
    New Member
    • Oct 2007
    • 115

    Switch between forms in a vb 6 project

    Hi everyone!

    How can we switch between forms in a VB 6 Project?

    Please ASAP
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    What exactly you mean by switch between forms ?

    Comment

    • Mohan Krishna
      New Member
      • Oct 2007
      • 115

      #3
      Originally posted by debasisdas
      What exactly you mean by switch between forms ?
      Sir,

      When several document windows in MS Office (which are MDI child forms) are open, then by pressing CTRL + F6 we can switch between those documents?

      In that manner, can we switch in the VB project, though they r not MDI forms?

      ThanQ for rspd.ing!

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        You need to do the coding for that.

        Comment

        • AHMEDYO
          New Member
          • Nov 2007
          • 112

          #5
          Hi....

          you can use Forms Object To Swap Between Forms
          Forms Object have Pointer for each loaded Form in your project

          Forms.cout ----> return Loaded Forms count
          Forms(n)

          For Example

          Code:
          Dim i As Integer
              For i = 0 To (Forms.Count - 1)
                  MsgBox Forms(i).Name
              Next
          sure this is not what you need, just i wanna say you can use FORMS object
          i will post to you code do exactly what you want

          GOOD LUCK

          Comment

          • AHMEDYO
            New Member
            • Nov 2007
            • 112

            #6
            Hey..

            I think you need something like that

            Form1.frm
            '============== =============== =============== =============

            [CODE=vb]Option Explicit

            Private CurrentForm As Integer
            Private Direction As Integer

            Private Sub Command1_Click( )
            If (CurrentForm = -1) Then
            Direction = 1
            CurrentForm = 1
            If (CurrentForm = Forms.Count) Then CurrentForm = 0
            ElseIf (CurrentForm = Forms.Count) Then
            Direction = -1
            CurrentForm = Forms.Count - 2
            If (CurrentForm < 0) Then CurrentForm = (Forms.Count - 1)
            End If
            Call Forms(CurrentFo rm).SetFocus
            CurrentForm = CurrentForm + Direction
            End Sub

            Private Sub Form_Load()
            Direction = 1
            Form2.Show
            Form3.Show
            End Sub[/CODE]

            Comment

            • Mohan Krishna
              New Member
              • Oct 2007
              • 115

              #7
              Originally posted by AHMEDYO
              Hey..

              I think you need something like that

              Form1.frm
              '============== =============== =============== =============
              :
              Thank You very much!
              Your code helped me a lot.
              I will try for improving so that we can assign the same for KEYS like F6 or CTRL + F6
              Thank you once again!

              Comment

              • AHMEDYO
                New Member
                • Nov 2007
                • 112

                #8
                Originally posted by Mohan Krishna
                Thank You very much!
                Your code helped me a lot.
                I will try for improving so that we can assign the same for KEYS like F6 or CTRL + F6
                Thank you once again!
                Many Thanx...

                GOOD LUCK.

                Comment

                Working...