For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > February 2006 > Showing forms









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Showing forms
rsine@stationeryhouse.com

2006-02-27, 7:55 am

I am trying to understand working with two forms. As part of my
understanding, I created two forms with a button on each. When I click
Form1's button, it hides Form1 and shows Form2. Form2's button needs
to close Form2 and show Form1. What is giving me issues is how do I
show Form1 again? There has to be an instance of it but I am unsure
how to reference it.

-Thanks

Larry Serflaten

2006-02-27, 7:55 am


<rsine@stationeryhouse.com> wrote
> I am trying to understand working with two forms. As part of my
> understanding, I created two forms with a button on each. When I click
> Form1's button, it hides Form1 and shows Form2. Form2's button needs
> to close Form2 and show Form1. What is giving me issues is how do I
> show Form1 again? There has to be an instance of it but I am unsure
> how to reference it.


You reference Form1 using 'Form1', just like you reference Form2 using 'Form2'

Those names are determined by the Name property of the respective forms....

HTH
LFS


Jan Hyde

2006-02-27, 6:56 pm

rsine@stationeryhouse.com's wild thoughts were released on
27 Feb 2006 05:11:32 -0800 bearing the following fruit:

>I am trying to understand working with two forms. As part of my
>understanding, I created two forms with a button on each. When I click
>Form1's button, it hides Form1 and shows Form2. Form2's button needs
>to close Form2 and show Form1. What is giving me issues is how do I
>show Form1 again? There has to be an instance of it but I am unsure
>how to reference it.
>
>-Thanks


I'm just curious, why are you hiding form1?



Jan Hyde (VB MVP)

--
Walking on water and developing software from a specification are easy if both are frozen.

(Edward V. Berard)

George Bashore

2006-02-27, 6:56 pm

try this to close form2
put this code in form2

Option Explicit

Private Sub Command1_Click()
SendKeys "%{F4}", True 'Alt + F4
Form1.Visible = True
End Sub

To hide form2 instead of close replace sendkeys with

Form2.Visible.False



<rsine@stationeryhouse.com> wrote in message
news:1141045892.340619.101700@i39g2000cwa.googlegroups.com...
>I am trying to understand working with two forms. As part of my
> understanding, I created two forms with a button on each. When I click
> Form1's button, it hides Form1 and shows Form2. Form2's button needs
> to close Form2 and show Form1. What is giving me issues is how do I
> show Form1 again? There has to be an instance of it but I am unsure
> how to reference it.
>
> -Thanks
>



Jan Hyde

2006-02-27, 6:56 pm

"George Bashore" <gbashore@bcpl.net>'s wild thoughts were
released on Mon, 27 Feb 2006 11:35:16 -0500 bearing the
following fruit:

>try this to close form2
>put this code in form2
>
>Option Explicit
>
>Private Sub Command1_Click()
>SendKeys "%{F4}", True 'Alt + F4
>Form1.Visible = True
>End Sub


Why?

>To hide form2 instead of close replace sendkeys with
>
>Form2.Visible.False
>


What?

;-)

J

>
><rsine@stationeryhouse.com> wrote in message
>news:1141045892.340619.101700@i39g2000cwa.googlegroups.com...
>



Jan Hyde (VB MVP)

--
Mirage a Trois: Act of having sex with two imaginary people. (Jill's Joke List)

Jeff Johnson [MVP: VB]

2006-02-27, 6:56 pm


"George Bashore" <gbashore@bcpl.net> wrote in message
news:ebLbFv7OGHA.2088@tk2msftngp13.phx.gbl...

> try this to close form2
> put this code in form2
>
> Option Explicit
>
> Private Sub Command1_Click()
> SendKeys "%{F4}", True 'Alt + F4
> Form1.Visible = True
> End Sub


SendKeys? You have got to be ^%&*#$ kidding!


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com