473,386 Members | 1,652 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.

count forms opened

I want to count all opened forms and list captions of all the forms. There is a loop control. I forgot it. can someone help me please.

thanks
raj
Oct 2 '06 #1
5 4994
I want to count all opened forms and list captions of all the forms. There is a loop control. I forgot it. can someone help me please.

thanks
raj

Do this:

Expand|Select|Wrap|Line Numbers
  1. Public Sub FindForms()
  2. Dim frx As Form, fCount As Integer
  3.   For Each frx In Forms()
  4.     fCount = fCount + 1
  5.     Debug.Print frx.Caption
  6.   Next
  7.   Debug.Print "Total forms found: " & Format(fCount)
  8. End Sub

Hope it solves your problem... :-)
Oct 2 '06 #2
Do this:

Expand|Select|Wrap|Line Numbers
  1. Public Sub FindForms()
  2. Dim frx As Form, fCount As Integer
  3.   For Each frx In Forms()
  4.     fCount = fCount + 1
  5.     Debug.Print frx.Caption
  6.   Next
  7.   Debug.Print "Total forms found: " & Format(fCount)
  8. End Sub

Hope it solves your problem... :-)
thanks. Now my problem is solved.
raj
Oct 30 '06 #3
Killer42
8,435 Expert 8TB
thanks. Now my problem is solved.
raj
Thanks from me, too. I like to think that I know a reasonable amount about VB6. But I had always thought (incorrectly as it turns out) that the Forms() collection included all the forms in your project, not just the open ones. It's always nice to learn something new. :)
Oct 30 '06 #4
Killer42
8,435 Expert 8TB
Sorry, one more point raj. You can get the count directly form the Forms.Count property if you don't need the captions.
Oct 30 '06 #5
Sorry, one more point raj. You can get the count directly form the Forms.Count property if you don't need the captions.
Thank you very much for giving additional information.
bye
raj
Oct 31 '06 #6

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

Similar topics

2
by: Bruno Rodrigues | last post by:
Hey, it's me again. Is there a way to, when closing a form, close also all forms opened inside this one? I'm not talking about MDI. Let's say I create and open three forms in Form1. When I close...
6
by: Tejpal Garhwal | last post by:
I have datagrid filled with some data rows. At the run time i want know how many total rows are there in the data grid ? Any idea ? Any Suggestions ? Thanks in advance Tej
4
by: Rothariger | last post by:
hello, i need to know if theres a way of doing that... some way of getting the number of forms, that a windows application contains... i need to browse all the forms. and make a list of all the...
7
by: Jeff | last post by:
I plan to write a Windows Forms MDI application for a medical office. Users must be able to select a patient and view related information on multiple forms; with1-4 forms opened at the same time...
18
by: Jerry Boone | last post by:
I'm looking for a way to fire a public sub/function when a form is opened and closed - without using form level events. I have already done some extensive form work with instancing, looping...
2
by: MORALBAROMETER | last post by:
Hallo, I want to write a programming with c#.Net having forms like MS Word. The main form A contain commonly used objects.I have many other forms (B,C,D) etc that have inherited from A. i realised...
2
by: HeroinNO.4 | last post by:
Hello everyone! Now the latest version of free count down timer source code is available in http://www.fillweb.com/countdown.htm, you can open it in IE and View->Source to see the latest version...
7
by: HeroinNO.4 | last post by:
Hello guys, free count down timer source code has updated to 06/11/27, you can copy the code below and save in a ".htm" file and run it in a browser support javascript 1.1 or later, or you can open...
1
by: robertmeyer1 | last post by:
Hey, I am having a problem with opening some forms. I have several forms. The forms are based off the same table, tblClient. Each form has a sbf inserted into it. These sbf’s are each based...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
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.