473,772 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing form-objects to subroutine

SV
Dear all,

In my application I have a lot of hidden fields. I want to make them invisible
for the users though for debugging reasons I want to make them visible. So I
want to add these objects to an array-variable and pass this variable to a
subroutine in which I make all stored objects in the array-variable invisible.

Can somebody explain me how to declare the correct variables, how to pass these
to a sub routine and how to make these objects invisible ?
This is what i have so far but without any success.

Private Sub Form_load()

dim HiddenFields() as object
HiddenFields(1) = me.TextBox1.nam e 'one object on the form
MakeUnvisible(H iddenFields) 'passing the array var to the subrouting

Endsub
public sub MakeUnvisible(B yRef Fields as object)
Fields(1).visib le = false
end sub

Thanks for any suggestions,

S.V.
Nov 13 '05 #1
3 5561
You may get a different answer to this, but IMHO, there is no need to pass
these objects to your functions (and I assume when you say "fields" that
what you actually mean are textBox controls from your form) . The Forms
collection is accessible at any time through code, so therefore, all of your
controls are accesible. Therefore, this code will work in any module or
form to reference the controls of any open (hidden or visible) form:
Dim formName as String
formName = "MainForm"
Forms(formName) .txtCompanyName .visible = False
Forms(formName) .lstEmployess.v isible = False
formName = "EmployeeFo rm"
Forms(formName) .cboJobTitle.vi sible = True

or

Forms("Position Form").txtDutie s.visible = False

or even

DoCmd.OpenForm "DataTransferFo rm"
Dim frm As Form
Set frm = Forms("DataTran sferForm")
frm.txtProgress Label.Caption = "Transferri ng Data"
Darryl Kerkeslager
"SV" <SV@skynet.be > wrote in message
news:41******** **************@ news.skynet.be. ..
Dear all,

In my application I have a lot of hidden fields. I want to make them invisible for the users though for debugging reasons I want to make them visible. So I want to add these objects to an array-variable and pass this variable to a
subroutine in which I make all stored objects in the array-variable invisible.
Can somebody explain me how to declare the correct variables, how to pass these to a sub routine and how to make these objects invisible ?
This is what i have so far but without any success.

Private Sub Form_load()

dim HiddenFields() as object
HiddenFields(1) = me.TextBox1.nam e 'one object on the form
MakeUnvisible(H iddenFields) 'passing the array var to the subrouting

Endsub
public sub MakeUnvisible(B yRef Fields as object)
Fields(1).visib le = false
end sub

Thanks for any suggestions,

S.V.

Nov 13 '05 #2
SV wrote:
Dear all,

In my application I have a lot of hidden fields. I want to make them
invisible for the users though for debugging reasons I want to make them
visible. So I want to add these objects to an array-variable and pass
this variable to a subroutine in which I make all stored objects in the
array-variable invisible.

Can somebody explain me how to declare the correct variables, how to
pass these to a sub routine and how to make these objects invisible ?
This is what i have so far but without any success.

Private Sub Form_load()

dim HiddenFields() as object
HiddenFields(1) = me.TextBox1.nam e 'one object on the form
MakeUnvisible(H iddenFields) 'passing the array var to the subrouting

Endsub
public sub MakeUnvisible(B yRef Fields as object)
Fields(1).visib le = false
end sub

Thanks for any suggestions,

S.V.

Here is an example
Sub PassAr()
'create 6 elements; ar(0)..ar(5)
Dim ar(5) As String
Dim i As Integer
ar(1) = "One"
ar(2) = "Two"
ar(3) = "Three"

'i should be 3
i = GetArCnt(ar())

'display the result...3
MsgBox "There are " & i & " elements"

'call a routine to set textbox one,two,three visible or invisible
SetVisible ar(),Me,True 'set them visible
SetVisible ar(),Me,False 'set them hidden
End Sub
Function GetArCnt(ar() As String) As Integer
Dim s As String
Do While True
'bypass ar(0) by adding 1
If ar(GetArCnt + 1) > "" Then
s = s & ar(GetArCnt + 1)
GetArCnt = GetArCnt + 1

'ex.

Else
'we have a blank row.
Exit Do
End If
Loop
'display string of elements passed
MsgBox s

GetArCnt = GetArCnt
End Function

Sub SetVisible(ar() As String, frm As Form, blnVisible) As Integer
Dim s As String
Do While True
'bypass ar(0) by adding 1
If ar(GetArCnt + 1) > "" Then
s = ar(GetArCnt + 1)
frm(s).Visible = blnVisible
Else
'we have a blank row.
Exit Do
End If
Loop
End Sub
Nov 13 '05 #3
I suggest in the Form_LOAD simply do this:

dim ctl as variant 'access.control
with me
for each ctl in array(.ctl1, .ctl2, ....) 'put your controls here
ctl.visible = DEBUGGING ' put your variable here
next
end with

"SV" <SV@skynet.be > wrote in message
news:41******** **************@ news.skynet.be. ..
Dear all,

In my application I have a lot of hidden fields. I want to make them invisible for the users though for debugging reasons I want to make them visible. So I want to add these objects to an array-variable and pass this variable to a
subroutine in which I make all stored objects in the array-variable invisible.
Can somebody explain me how to declare the correct variables, how to pass these to a sub routine and how to make these objects invisible ?
This is what i have so far but without any success.

Private Sub Form_load()

dim HiddenFields() as object
HiddenFields(1) = me.TextBox1.nam e 'one object on the form
MakeUnvisible(H iddenFields) 'passing the array var to the subrouting

Endsub
public sub MakeUnvisible(B yRef Fields as object)
Fields(1).visib le = false
end sub

Thanks for any suggestions,

S.V.

Nov 13 '05 #4

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

Similar topics

5
5942
by: Paul | last post by:
I want to use sessions to cover myself in case the user switches off cookies so I am passing the session ID manually through a hidden input field. This is what I have so far. index.php page contains: <?php $_SESSION = ""; $_SESSION = "";
1
7789
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains: ---------------------------------------------------------------------------- <?php ini_set("session.use_cookies", "off"); ini_set("session.use_trans_sid", "on"); session_start(); $_SESSION = ""; $_SESSION = ""; echo "<form method='POST' action='login.php'>
2
2726
by: Curtis Justus | last post by:
Hi, I currently have a control that is on a form and I want to pass that exact instance of the control to another form (a child form that appears on a button click). The control has state, etc. that works with both forms. In my button click on FormA, I take my control and pass it to a constructor in FormB. Here is the code in the constructor:
4
4871
by: Ron Rohrssen | last post by:
I want to show a dialog and when the form (dialog) is closed, return to the calling form. The calling form should then be able to pass the child form to another object with the form as a parameter. For example, FormOptions formOptions = new FormOptions(); if (formOptions.ShowDialog(this) == DialogResult.OK) {
8
4415
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and click a button to determine whether the zip code is unique. If the zip code is not unique, another form/dialog is displayed (fclsLookup) - lookup form/dialog. The zip code is passed to the lookup form/dialog by reference. I then load a...
13
2520
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On Error GoTo err_zoom strFormName = formName
7
10395
by: AMP | last post by:
Hello, I have this in form1: namespace Pass { public partial class Form1 : Form { public Form2 form2; public Form1() {
0
1544
by: Magnus Bergh | last post by:
I am developing an application for pocketpc and this involvs a but of juggling with different forms. I have an "order entry" type of application. On the main form I have a grid which displays Order headers. Let call this form "OrderList" From this view I edit/enter new orders by opening a new form for entering data. This is done using (more or less) the designer generated forms, so I have a "Order edit view dialog. I pass the binding...
5
3208
by: jmartmem | last post by:
Greetings, I have built an Update Record Form in an ASP page. This form contains a number of fields, such as text boxes and menus, to name a few. Upon clicking the 'submit' button, I want the form values to pass to a confirmation page that shows the values entered and selected, with a CDONTS auto email generated at the same time. My problem is that I'm having trouble passing the values from the form to both the confirmation page and the...
4
5934
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh them I just set their datasource. I am guessing this is probably what is causing the problem. Is there a better way to do this? Anyway this all works happily and things show up when the record already exists but I have 2 problems ; 1) When I add...
0
9619
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
9454
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,...
0
10103
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9911
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
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6713
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
5354
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...
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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.