Solved

2 frames in a form

Posted on 2000-05-14
10
172 Views
Last Modified: 2010-05-02
i have 2 frames in my form. i need to perform this. an event in frame1 makes it invisible and i want to display frame2 in the same location as that of frame1. but this isnt happening. during design, the frame2 is on frame1 and so frame2 becomes an obj of frame1. i tried "send to back" option on frame2, but dosent work.
kindly help
thanks
0
Comment
Question by:Sankar030999
10 Comments
 
LVL 1

Expert Comment

by:ofirg
ID: 2808369
1) open new form
2) add frame1
3) click on the form background
4) add a scond control

now you have two frame on the form and not one within enother.
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2808370
Were you using something like this:

Private Sub Command1_Click()
    Frame2.Left = Frame1.Left
    Frame2.Top = Frame1.Top
    Frame2.Width = Frame1.Width
    Frame2.Height = Frame1.Height
    Frame2.Visible = True
    Frame1.Visible = False
End Sub

Private Sub Command2_Click()
    Frame1.Left = Frame2.Left
    Frame1.Top = Frame2.Top
    Frame1.Width = Frame2.Width
    Frame1.Height = Frame2.Height
    Frame1.Visible = True
    Frame2.Visible = False
End Sub

Where Command1 hides Frame1 and shows Frame2 where Frame1 was.  Command2 does the reverse.
0
 
LVL 3

Expert Comment

by:fibdev
ID: 2808373
Try it like this:

Sub Form_Load()
  Frame1.visible = true
  Frame2.visible = false
end sub


Sub EventTrigger_Click() ' eventtrigger being the event you mentioned

  Frame1.visible = false

 ' Do your stuff here
  With Frame2
     .top = Frame1.top
     .left = Frame1.left
     .hieght = Frame1.hieght
     .width = Frame1.Width
  End With
  Frame2.visible = true

End Sub
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:fibdev
ID: 2808377
with my example

create frame1 on the form first
then create frame2 anywhere on the form (out of the way would be best because it will be sized and posistioned at run time).
0
 
LVL 3

Expert Comment

by:fibdev
ID: 2808378
this may be a little faster:

Sub EventTrigger_Click() ' eventtrigger being the event you mentioned

  ' Do your stuff here
  With Frame2
     .top = Frame1.top
     .left = Frame1.left
     .hieght = Frame1.hieght
     .width = Frame1.Width
  End With

  Frame1.visible = false  
  Frame2.visible = true

End Sub
0
 
LVL 14

Accepted Solution

by:
wsh2 earned 100 total points
ID: 2808395
Right click on the Frame that is contained INSIDE of the other Frame and select Cut. Then place and click your mouse pointer on the form OUTSIDE of the Frame that is left.. right click again and Paste. As long as the one Frame is contained in the other.. the Outer frame is considered the Parent.. and the Inner form will be subject to any dictates of it.

As to sizing the second Frame, the most efficient way to do it is to use the Move method. Eg.

With Frame1
  Frame2.Move .Left, .Top, .Width, .Height
End With



0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2808513
you could also use a control array, which is always good practice whenever it can be used b/c it saves memory (in this case its minimal but i'm just making noise)
also the way you make it sound you are adding this frame right on top of the other frame at design time?  where are the controls on the second frame?  seems they would be getting pretty cluttered at this point.  are you just changing captions or other simple properties?  just curious as to the use of the two frames...
0
 

Expert Comment

by:jusclev
ID: 2809159
Hi Sankar,

Try this: It switches containers, then moves the remaining frame top the desired position. I used it twice and it worked fine.

Private Sub Event_Name (args)

Set Frame2.Container = Frame1.Container

With Frame1
    Frame2.Move .Left, .Top, .Width, .Height
    .Visible = False
End With

Frame2.visible = true
End Sub
0
 

Author Comment

by:Sankar030999
ID: 2812946
Adjusted points from 50 to 100
0
 

Author Comment

by:Sankar030999
ID: 2812947
the cut and paste mtd wormed fine.
thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question