473,769 Members | 5,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling a class' private method from a form

Hi,
I'm trying to use a class to pass variables back and forth from a
form opened in dialog mode.
I have created a class which invokes a form in its show method, like
so:

Public Sub Show()
' This method shows the form used to get the info
If sWhereInt = "" Then
DoCmd.OpenForm sFormNameInt, acNormal, , , acFormAdd, _
acDialog
Else
DoCmd.OpenForm sFormNameInt, acNormal, , sWhereInt, _
acFormEdit, acDialog
End If
End Sub

I collect parameter values using:

Property Let SetParam(sName As String, vValue As Variant)

dParamDict(sNam e) = vValue

End Property

where dParamDict is a Scripting.Dicti onary object which has been set on
class initialization.

I would like to define a private method (or property if necessary)
visible to the form to retrieve parameter values. All of my efforts so
far have failed.

Can anyone provide any guidance?

Many thanks,

Eric

Nov 13 '05
14 3011
Blocking. The only effective way in Access (AFAIK) to cause code
execution to block is either to use MsgBox or open a form as dialog.

Plus, part of what I'm trying to do is abstract a
"getInformation FromUser" function of class that is not specific to the
form used to do so.

Any ideas on making code block?

Nov 13 '05 #11
rkc
er***********@g mail.com wrote:
That looks like exactly what I'm trying to do, and I think that would
work nicely with the idea of the form automatically getting any values
it can from the calling function.

Only one key problem:

Setting form to modal does not cause the calling code to block.


By block do you mean suspend? I don't see why you need the code
to wait for anything unless getting the dictionary object to the
dialog form is not all you wanted to do. You do realize that any
changes made to the dictionary object by the dialog form will be
reflected in the calling form.
Nov 13 '05 #12
Sorry, didn't realize I was being unclear. By blocking I do mean
suspend execution of code. Your point that since the dictionary object
on the dialog form and the on in the calling function are the same they
have the same values is well taken.

I guess that might make it work. I'll try passing a dictionary object
with my parameter values...

Thanks,

EE

Nov 13 '05 #13
rkc
er***********@g mail.com wrote:
Sorry, didn't realize I was being unclear. By blocking I do mean
suspend execution of code. Your point that since the dictionary object
on the dialog form and the on in the calling function are the same they
have the same values is well taken.

I guess that might make it work. I'll try passing a dictionary object
with my parameter values...


There's also the WithEvents keyword whereby the calling object can
subscribe to the dialog form's Close event and run code in the calling
class when the dialog form closes. That gives you the same 'blocking'
affect as actually opening the form in dialog mode via docmd.openform.

Nov 13 '05 #14
er***********@g mail.com wrote:
Blocking. The only effective way in Access (AFAIK) to cause code
execution to block is either to use MsgBox or open a form as dialog.

Plus, part of what I'm trying to do is abstract a
"getInformation FromUser" function of class that is not specific to the
form used to do so.

Any ideas on making code block?

Other than opening the form with the acDialog option that I mentioned
in my previous post you could cycle waiting for the form to close:
Const conObjStateClos ed = 0

DoCmd.OpenForm "frmReportsOutp ut"

Do While SysCmd(acSysCmd GetObjectState, acForm, "frmReportsOutp ut")
<> conObjStateClos ed
DoEvents
Loop
Note that one of the lines wrapped. Beyond these two examples you'll
have to investigate the Win Sleep() API (there is one of those
isn't there? or am I thinking of BSD??).
--
'---------------
'John Mishefske
'---------------
Nov 13 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9782
by: Tony Liu | last post by:
Hi, I want to get the name of the calling function of an executing function, I use the StackTrace class to do this and it seems working. However, does anyone think that there any side effect towards this approach such as how would it works in multi-thread. Thanks Tony
6
3229
by: Gary Miller | last post by:
Does anyone know how to detect a modeless form on closing by the form that invoked the modeless form? form.Show();
2
6612
by: mark | last post by:
I am developing an application in .Net C# that needs to restore a number of tool windows to some previous location and size. The problem I have is that when I create the form and set the Location and Size properties before calling the Show method, the form is not created in the Location that I set. If I call Show first everything works fine but there is excesive flicker when the Location and Size properties are set. I tried calling...
5
3096
by: Bennett Haselton | last post by:
I've noticed that if you enter the following code in the codebehind page for an .aspx page, it won't compile because the call to Trace.Write() is not valid except in methods of a class derived from System.Web.UI.Page. Two questions: 1) I don't know much about C# but I was under the impression that if certain classes and functions were available in a namespace (as the result of a "using" statement at the top of a file), then they were...
2
27263
by: Macca | last post by:
Hi, I have a windows form project. The form class has a number of methods in it that i want to call from another class I have just created. This class is a finite state machine and is created and kicked off in same method where the applications' Run method is called. i.e main method in Program.cs. I'd appreciate suggesstions for calling methods in the form class from this
4
2255
by: Bugs | last post by:
Hi, I wonder if anyone can help me out. I'm building a vb.net application that has a form with a panel that contains several other sub forms (as a collection of controls). What I'm wanting to do is call a generically named public sub in the top-most sub form in the panel. I have the name of the top-most form as a string (eg. g_TopForm = "frmCustomers") and I can reference the form with:
6
2434
by: ahmad.humyn | last post by:
I want to call a hidden form. My code goes something like in which the main calls form1. form1 has a button which creates & calls form2 and hides itself. Now I have a button in form2 which if pressed should dispose form2 and then unhide and focus form1. -------------------------------------------------- static void Main() { ..... Application.Run(new Form1());
8
12621
by: Jeff | last post by:
Still new to vb.net in VS2005 web developer... What is the proper/standard way of doing the following - setting the value of a variable in one sub and calling it from another? E.g., as below. The code below draws an error as indicated. Surely there has to be a better way than to make xxx a session variable? Thanks
15
8211
by: =?Utf-8?B?VG9tIENvcmNvcmFu?= | last post by:
I've been led to believe by several articles, particularly Eric Gunnerson's C# Calling Code Dynamically, that calling a method dynamically through Reflection was much slower than through a Delegate. My testing showed that actually it was six times faster: 0.5 seconds for 100,000 iterations versus 3.1 seconds. Can anyone explain why? Something in the way I coded it? I'd appreciate any insights. Here's the code (in a Windows Form...
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.