473,386 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Switch between forms in a vb 6 project

Mohan Krishna
115 100+
Hi everyone!

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

Please ASAP
Nov 16 '07 #1
7 2924
debasisdas
8,127 Expert 4TB
What exactly you mean by switch between forms ?
Nov 16 '07 #2
Mohan Krishna
115 100+
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!
Nov 16 '07 #3
debasisdas
8,127 Expert 4TB
You need to do the coding for that.
Nov 16 '07 #4
AHMEDYO
112 100+
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

Expand|Select|Wrap|Line Numbers
  1. Dim i As Integer
  2.     For i = 0 To (Forms.Count - 1)
  3.         MsgBox Forms(i).Name
  4.     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
Nov 16 '07 #5
AHMEDYO
112 100+
Hey..

I think you need something like that

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

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3. Private CurrentForm As Integer
  4. Private Direction As Integer
  5.  
  6. Private Sub Command1_Click()
  7.     If (CurrentForm = -1) Then
  8.         Direction = 1
  9.         CurrentForm = 1
  10.         If (CurrentForm = Forms.Count) Then CurrentForm = 0
  11.     ElseIf (CurrentForm = Forms.Count) Then
  12.         Direction = -1
  13.         CurrentForm = Forms.Count - 2
  14.         If (CurrentForm < 0) Then CurrentForm = (Forms.Count - 1)
  15.     End If
  16.     Call Forms(CurrentForm).SetFocus
  17.     CurrentForm = CurrentForm + Direction
  18. End Sub
  19.  
  20. Private Sub Form_Load()
  21.     Direction = 1
  22.     Form2.Show
  23.     Form3.Show
  24. End Sub
Nov 16 '07 #6
Mohan Krishna
115 100+
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!
Nov 17 '07 #7
AHMEDYO
112 100+
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.
Nov 17 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Angelos | last post by:
Ok... I have to make this administation area where I have multiple Contents to add edit delete publish . The problem is that I don't know what is the best way of making the forms. At the moment I...
1
by: wayneh | last post by:
I have an option group on a form with three choices "Yes/No/All" I'm using a switch function in a query to filter records on a Yes/No field. There is no problem displaying records that are either...
18
by: Torben Laursen | last post by:
Hi Can anyone tell me what is the short-cut to switch between a .h and .cpp file, thanks Torben Laursen ---
5
by: Yavuz Bogazci | last post by:
Hi, i have the following problem: In VB6 i switched between two forms on this way: FORM1: sub onButton_Click form2.show me.close
5
by: Saladin | last post by:
Hello I use a module to determine whether SQL connection is to my localhost or to my remote server. At moment, I enable either one or the other line of code to switch between, then build, (then...
9
by: PhreakRox | last post by:
The ToClose switch in this program is not working as expected, it allways returns a null value, if anyone knows a way to fix up the code, or can suggest a better method of doing so, your help would...
0
by: Massimiliano Polito | last post by:
It seems the option '/useenv' is no longer supported in in Microsoft Visual .NET 2005. If I run 'devenv /?' I get the following: ------------------------ Microsoft (R) Visual Studio Version...
2
by: teixeira1985 | last post by:
Hi , Due an unknown cause VS2005 started to show an error when i switch from code to design in windows forms projects. I repaired the installation but the same happens. The error is: One or...
4
by: kpfunf | last post by:
I have a field whose criteria I can't quite work out. I have an Option Group on a form. If the value is 2, 3 or 4, then criteria equals as shown below (works fine). The kicker is value 1: I want...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.