Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Linking one form to another in VB6

Last post 04-25-2008 2:34 PM by shananne81. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 04-05-2008 12:15 PM

    • shananne81
    • Not Ranked
    • Joined on 03-03-2008
    • United Kingdom
    • New Member
    • Points 100

    Linking one form to another in VB6

    Hi,

    How do i link or move from one form to another in one application?

    Shananne

    • Post Points: 20
  • 04-09-2008 11:52 PM In reply to

    • Sagem
    • Not Ranked
    • Joined on 04-09-2008
    • United States
    • New Member
    • Points 25

    Re: Linking one form to another in VB6

    Hi Mate,

    I am sure you have already found the answer to this question however just incase anyone else wishes to know.

     

    The easiest way to complete this task is (take into account the form names might not actually be form1 and form2)

    form1.hide

    form2.show

    • Post Points: 10
  • 04-11-2008 1:02 PM In reply to

    Re: Linking one form to another in VB6

    Hi,

    Its not like that you have to link manually a form to another. See you have 2 mothods. Form.Show and Form.Hide

    Where ever you want to show Form1, just call Form1.show.....want to visible false....form1.visible=false

    Thats it...........

     Ramesh Sambari

    for more information please contact sambariramesh@gmail.com
    • Post Points: 5
  • 04-11-2008 2:21 PM In reply to

    • shananne81
    • Not Ranked
    • Joined on 03-03-2008
    • United Kingdom
    • New Member
    • Points 100

    Re: Linking one form to another in VB6

    Hi,

    Thanks alot,

    Regards,

    Shanaya

    • Post Points: 10
  • 04-14-2008 11:06 PM In reply to

    • krashcraft
    • Not Ranked
    • Joined on 04-14-2008
    • United States
    • New Member
    • Points 40

    Re: Linking one form to another in VB6

     OK, I also understand that, but.... is there an easy way to transfer data from one "hidden" form to the other "shown" form? Form1-the hidden form -- is using a timer - "countdown", but I want the data from form1 to be shown in form2.

    krashcraft 

    • Post Points: 10
  • 04-15-2008 9:55 AM In reply to

    • Jugatsu
    • Top 500 Contributor
    • Joined on 02-15-2006
    • Member
    • Points 290

    Re: Linking one form to another in VB6

    Hi

    Declare a public variable in Form1

    Public s As String
    Private Sub Form_Load()
     s = "Hello"
     Form2.Show
    End Sub

    For Form2 to read the string variable s

    Private Sub Form_Load()
     MsgBox Form1.s
    End Sub

     

    • Post Points: 10
  • 04-15-2008 3:58 PM In reply to

    • krashcraft
    • Not Ranked
    • Joined on 04-14-2008
    • United States
    • New Member
    • Points 40

    Re: Linking one form to another in VB6

     OK, what is happening here:

    Form 1 -- textbox and button

    Form 2 -- textbox and button

    Form 1 ---------------------------------------------------------------------- 

        Public s As String

        Private Sub Command1_Click()
            s = Text1.Text
            Form2.Show
            Form1.Hide

        End Sub

    Form 2 ----------------------------------------------------------------------- 

        Private Sub Command1_Click()
              Form2.Hide
              Form1.Show
        End Sub

        Private Sub Form_Load()
             Text1.Text = Form1.s
         End Sub
     ------------------------------------------------------------------------------------------------

    <>Everything works fine the first time. I enter text into Form1 textbox, click the button and it is displayed in Form2 textbox, then I click on Form2 button and Form 1 is displayed again.

    but.....

    When I change the text in Form1 textbox and click the button again, the textbox in Form2 is the same as the first. It doesn't get updated.

    Keith 

    <> 

     

    <> 
    • Post Points: 5
  • 04-16-2008 10:21 AM In reply to

    • Jugatsu
    • Top 500 Contributor
    • Joined on 02-15-2006
    • Member
    • Points 290

    Re: Linking one form to another in VB6

    The problem is with Form_Load()

    This is only called once to initalise the form

    Use Form_Activate() , this will execute eachtime the form is shown.

    i.e.

    Form 1 ----------------------------------------------------------------------

        Public s As String

        Private Sub Command1_Click()
            s = Text1.Text
            Form2.Show
            Form1.Hide

        End Sub

        Private Sub Form_Activate()
             Text1.Text = s
         End Sub
    Form 2 -----------------------------------------------------------------------

        Private Sub Command1_Click()
              Form2.Hide
       Form1.s = Text1.Text
              Form1.Show
        End Sub

        Private Sub Form_Activate()
             Text1.Text = Form1.s
         End Sub
     ------------------------------------------------------------------------------------------------
     

    • Post Points: 10
  • 04-16-2008 1:57 PM In reply to

    • krashcraft
    • Not Ranked
    • Joined on 04-14-2008
    • United States
    • New Member
    • Points 40

    Re: Linking one form to another in VB6

     Thanks, That is the way I was thinking it SHOULD work.

    By the way, where do you guys find all these references? Where is good documentation about Form_Activate? etc...  Each day I keep finding more commands/functions/etc... that I have never seen any reference or documentation about.

    It is like I am try to program in a language, but nobody wants to let you know what all the commands are. Just enough commands to let you tinker.  The commands are there, but nobody is wanting you know what the commands are or where to find them.

    <> Keith
     
    • Post Points: 10
  • 04-25-2008 2:34 PM In reply to

    • shananne81
    • Not Ranked
    • Joined on 03-03-2008
    • United Kingdom
    • New Member
    • Points 100

    Re: Linking one form to another in VB6

    Hi all,

    please could someone help i keep losing my file dont know why....i have a file in my memory stick, but this shows up everytime i try to run VB6 where should i make the changes.?

    \\filespace\home\anmwasya\End Year ProjectProgramming\Barclays.mdb

    Thank you all,

    shananne

    • Post Points: 5
Page 1 of 1 (10 items)