473,387 Members | 1,742 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,387 software developers and data experts.

how to pass a form as parameter

11
I am trying to pass a form as a parameter in a function. How can i do that?

I have tried function( frm as Form) then on the calling routing i try to use
private sub callingRoutine()
Dim frm1 as Form
set frm = Me
callFunction(frm)
end sub

This fails either on the calling routine or when i get into the function that needs to use the form. I get various errors depending on how i am hacking the code.

Thanks
Nov 25 '08 #1
3 21821
ChipR
1,287 Expert 1GB
I know you can do this:

callFunction(Me.Name)
-----------------------------------------
Public callFunction(strFormName as String)
Forms(strFormName).Visible = True
'or whatever you want to do on the form.

Hope that helps.
Nov 25 '08 #2
FishVal
2,653 Expert 2GB
Hello, ofilha.

Actually your approach is quite right.
However, it seems to me you have a syntax problems.
Could you post the code exactly as it looks?
Nov 25 '08 #3
ADezii
8,834 Expert 8TB
As stated by FishVal, your approach is correct, but your Syntax is not!
Expand|Select|Wrap|Line Numbers
  1. Private Sub CallingRoutine()
  2. Dim frm1 As Form
  3.  
  4. Set frm1 = Me
  5.  
  6. '*** Either Call Routine will work ***
  7. Call fTestFormParameter(frm1)
  8. Call fTestFormParameter(Me)
  9. '*************************************
  10. End Sub
Expand|Select|Wrap|Line Numbers
  1. Public Function fTestFormParameter(frmForm As Form)
  2.   MsgBox "The Caption of the passed Form is " & frmForm.Caption
  3. End Function
P.S. - CallingRoutine() is Private to the Form while fTestFormParameter() is a Public Function in a Standard Code Module. fTestFormParameter() can also be Private within the context of the Form where CallingRoutine() resides.
Nov 26 '08 #4

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

Similar topics

5
by: Belinda | last post by:
Hello All I have the following test.asp page which needs one parameter querystr but my querystr is a very long string value. When I send a long value the query string is getting truncated after...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
5
by: Fresh Air Rider | last post by:
Hello Could anyone please explain how I can pass more than one arguement/parameter value to a function using <asp:linkbutton> or is this a major shortfall of the language ? Consider the...
9
by: Jay Douglas | last post by:
Hello, I am needing to pass a class object (this) by reference to a method in a different class. When I do the following code I get the error (Cannot pass '<this>' as a ref or out argument because...
6
by: Vern | last post by:
I'd like to make the following a generic method that all my forms can call to validate all the fields on the form. So how do I pass the form object that is represented as "this" in the following...
3
by: Brett | last post by:
I have several classes that create arrays of data and have certain properties. Call them A thru D classes, which means there are four. I can call certain methods in each class and get back an...
3
by: Brad McMillan | last post by:
Hi: I have MS C# 2005 Express Edition and I'm trying to pass a string to a new form in my project. First I created the form, Customer, with a textbox, "textBox1", and declared a string...
5
by: JohnDriver | last post by:
Hi, I am having a form which has a text box and 3 radio buttons. I am using GET method in Ajax to pass the value. I can pass the value of the textbox fine but how to pass the value of radio...
24
by: =?Utf-8?B?U3dhcHB5?= | last post by:
Can anyone suggest me to pass more parameters other than two parameter for events like the following? Event: Onbutton_click(object sender, EventArgs e)" Event handler: button.Click += new...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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.