Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Form changes...


Message #1 by Rosenbaum <elladi@n...> on Sun, 11 Nov 2001 16:41:22 +0200
Hi Adina,

You can use frames as Shreekar mentioned.
If I have understood you well then here's a simple example:
Create following things:
1. Form
2. Put frame Frame1 on the form
3. Put textbox Text1 on the frame1
4. Put frame frame2 on the form right above frame1 with same size etc. 
(you can put it anywhere for that matter).
5. Put label1 on frame2
6. Put two command buttons on the form (but not on any of these frames)
You can very well use menu instead of command buttons.

Type the following code in the form
Option Explicit

Private Sub Command1_Click()
    If Frame1.Visible = False Then Frame1.Visible = True
    If Frame2.Visible = True Then Frame2.Visible = False
End Sub

Private Sub Command2_Click()
    If Frame2.Visible = False Then Frame2.Visible = True
    If Frame1.Visible = True Then Frame1.Visible = False
End Sub

Private Sub Form_Load()
    'Set same dimensions for frame1 and frame2
    Frame1.Height = Frame2.Height
    Frame1.Width = Frame2.Width
    'Put on frame on top of other, you can put it anywhere though!
    Frame1.Top = Frame2.Top
    Frame1.Left = Frame2.Left

    Frame2.Visible = False
    Text1.Text = "I'm on Frame1"
    Text1.ForeColor = RGB(0, 0, 255)    'Better visibility
    Label1.Caption = "I'm on Frame2!"
    Label1.ForeColor = RGB(255, 0, 0)   'Better visibility
End Sub

Now run it and click on command buttons 1 and 2. There you are!
Hope this helps,
Prakash

> This is a multi-part message in MIME format.
> 
> --Boundary_(ID_lpXiWC93saxmDdms2TUuxA)
> Content-type: text/plain; charset=windows-1255
> Content-transfer-encoding: 7BIT
> 
> I asked this question before but I dont think I was clear (based on the 
answers I recieved) so I will try to clarify...I have a main form that is 
divided into different areas one area of the from needs to look different 
based on different option chosen from a side bar or the menu....
> 
> for example lets say someone chooses calender from the menu option a 
calender would appear there in that area....or if they choose clock a 
clock would appear or if they choose file list that are should be albe to 
contain the listview control....my question is is how to swap in and out 
of the some are various controls 
> 
> I dont want to have to use dialog boxes....I want it all to be contained 
on the same form....is this possible and if so how.....
> 
> another way of understanding it...is the same effect of a tab strip were 
you have 5 screens all in the same area but it is really 5 different forms 
but without the tabs on the top ( they switch instead by buttons on the 
side or options from the menu ...)
> 
> Thank you,
> Adina
> 
> I hope I have made myself clear....
> 
> --Boundary_(ID_lpXiWC93saxmDdms2TUuxA)
> Content-type: text/html; charset=windows-1255
> Content-transfer-encoding: 7BIT
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=Content-Type content="text/html; charset=windows-1255">
> <META content="MSHTML 5.50.4522.1800" name=GENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=#ffffff>
> <DIV><FONT face=Arial size=2>I asked this question before but I dont 
think I was 
> clear (based on the answers I recieved) so I will try to clarify...I 
have a main 
> form that is divided into different areas one area of the from needs to 
look 
> different based on different option chosen from a side bar or the 
> menu....</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>for example lets say someone chooses 
calender from 
> the menu option a calender would appear there in that area....or if they 
choose 
> clock a clock would appear or if they choose file list that are should 
be albe 
> to contain the listview control....my question is is how to swap in and 
out of 
> the some are various controls </FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>I dont want to have to use dialog 
boxes....I want 
> it all to be contained on the same form....is this possible and if so 
> how.....</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>another way of understanding it...is the 
same 
> effect of a tab strip were you have 5 screens all in the same area but 
it is 
> really 5 different forms but without the tabs on the top ( they switch 
instead 
> by buttons on the side or options from the menu ...)</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>Thank you,</FONT></DIV>
> <DIV><FONT face=Arial size=2>Adina</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>I hope I have made myself 
> clear....</FONT></DIV></BODY></HTML>
> 
> --Boundary_(ID_lpXiWC93saxmDdms2TUuxA)--

  Return to Index