Solved

how could i access a form created using instance by code?

Posted on 2001-06-27
5
134 Views
Last Modified: 2010-05-02
I have created an mdiform containing a new menu.in this i create an instance of another form which contains a text box.every time i click i get a new instance of the form. i save the text in the text box using Activeform property in a random file.say i have 4 instances of the same form if i quit the app i rise a question to save the text in a file.i could only save the active form's text for no of times the instance of the form is created.how could i access the remaining 3 forms and save it?
0
Comment
Question by:GaneshDevx
5 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 75 total points
Comment Utility
If you use the Forms collection you can do this:

On Error Resume Next
Open "MyFile" For Output As #1
For Each MyForm In Forms
  Print MyForm.Text1.Text
Next

This is just the simplest version, you should add some additional verification in case you have other forms which do not have the same control. In this way you would also write the value for the activeform so you could do away with that part of your code.
0
 
LVL 49

Expert Comment

by:Ryan Chong
Comment Utility
Hi,

When quit the program:

Do while <ActiveForm is not nothing>
   <Save value to your file>
   <Close the current form>
loop
0
 
LVL 1

Expert Comment

by:HelixDaKat
Comment Utility
In the form tht has the textbox add a Property that indicates that the contents of the box have changed.

In the unload event of the form add code to prompt the user to save the modified information.

This way you will always get a prompt when ever the user changes anything on anyform.

So if the user changes the values of windows 1,2, & 4. The user will be prompt 3 times to save the information.

HDK
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
Hi GaneshDevx,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept TimCottee's comment(s) as an answer.

GaneshDevx, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
Comment Utility
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

771 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now