Solved

Avoiding Public global variables when getting data from modular form

Posted on 2004-08-17
4
222 Views
Last Modified: 2010-05-02
Suggestions, please:

In a VB6 app, I'm using a modular form to gather user input for processing by the parent from.

I use public global variables to carry the data from the modular form to its parent. (For reasons nothing to do with the question, globals are more useful in the particular situation than module-level variables.)

Is there a better alternative to global or vmodule-level variables to capture the data from the modular form and pass it to the parent form, pelase?

Thanks in anticipation.
0
Comment
Question by:Gordon_Atherley
  • 2
4 Comments
 
LVL 2

Expert Comment

by:MrPan
ID: 11821294
There are a couple of ways.

I assume that you are using form2.show 1

You could replace it with

Dim frmMod as frmMOdular

frmMod.Show 1

data= frmmode.txtboxdata

unload frmMode.


You will have to change the close button on the modular form to hide the form instead of closing.

0
 
LVL 2

Accepted Solution

by:
MrPan earned 125 total points
ID: 11821329
change Dim frmMod as frmMOdular

to be

Dim frmMod as New frmMOdular
0
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11821435
First form (not modal)

Private Sub Command1_Click()
    Dim a As String
    Dim b As String
    Call Form2.ShowModalForm(a, b)
   
    MsgBox a & " " & b
End Sub

Second form (modal)

Public Function ShowModalForm(Var1 As String, Var2 As String)
    Me.Show vbModal
   
    Var1 = Text1.Text
    Var2 = Text2.Text
End Function
0
 

Author Comment

by:Gordon_Atherley
ID: 11821443
Thank you for the prompt and valuable response, appreciated

The EE respose time is getting into the nanosecond domain, great work!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…

770 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