Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Pass a Parmeter to an instance of a Form object without using Global variable declaration..??

Posted on 2006-10-23
4
Medium Priority
?
224 Views
Last Modified: 2010-04-23
EE Experts:

I have been researching this question and so far I have not found an answer. I passed the Java programmer certification test but have never worked professionally in Java. So I'll use Java OOP terminlogy to describe what I am trying to do.

In Java I can declare a private class instance variable that is within scope to all methods in that class. Within that class, I can declare a publicly accessable method usually called a Getter or Setter method so that all methods in all objects can get or set the value of that private variable. Each object instantiated from that class has its own private instance variable so that the object that is an instance of that class does not have to share its private instance variable with other objects instantiated from that class.

This is a way of avoiding the risk involved with passing parameters to a form object which is an instance of its VB.NET form class declaration without going through a globally accessable variable. A risky proposition.

VB.NET won't let me declare a function in a form class or declare a Sub(routine) public as best I can tell without getting those squiggly blue lines that indicate a syntax error. I now have a
"Private ii_InsuredPickParm As Integer"  though.

Thank you,
TedPalmer
0
Comment
Question by:Ted Palmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Expert Comment

by:DjDezmond
ID: 17789741
You can set a property up...

Public Property SetInteger()
  Get
    Return PrivateVariable
  End Get
  Set (byval value)
   PrivateVariable = value
  End Set
End Property

Not sure if this is what you want, but hope it helps
0
 

Author Comment

by:Ted Palmer
ID: 17789824
DjDezmond:

Thanks for the response. This looks good. Now that you have posted it I recall seeing an example of how to declare a property elsewhere, but it didn't occur to me that this was a possible solution to my problem. I'll experiment with this this after noon and get back on this message thread soon.

Thank you,

TedPalmer
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 17790029
"VB.NET won't let me declare a function in a form class or declare a Sub(routine) public as best I can tell without getting those squiggly blue lines that indicate a syntax error."

For the record though, you can in fact declare subs/functions in a class as Public.  Show us your code...
0
 

Author Comment

by:Ted Palmer
ID: 17790789
Idle_Mind,

You are right about ". . . declare subs/functions in a class as Public". I just messed up. I was appending my code below the "End Class" statement. I did a Control-End and just started typing not realizing that I was outside the bounds of the class declaration.

That takes care of that issue.

Thank you,
TedPalmer
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

688 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