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

x
?
Solved

RHS assignment

Posted on 2002-07-16
11
Medium Priority
?
323 Views
Last Modified: 2010-05-02
Can someone explain the RHS value and meaning in a call like this:

Public Property Let MainDB(RHS As String)
   mstrMainDB = RHS
End Property





0
Comment
Question by:afterburner
[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
  • 5
  • 5
11 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 7157740
RHS = Right-Hand-Side

In a property Let statement, you pass a new value to set for the specified property, e.g.:

Text1.Text = "New String"

Here you set the Text1 object's Text property, passing in the value, "New String", which is the RHS value in question
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 7157759
RHS refers to the SIDE of the "=" in an expression.

RHS is the part of the expression the is on the Right-Hand side of the "=".  Similarly, you may see the use of LHS, or Left-Hand Side, meaning the part that is on the Left-Hand side of the "=".

Arthur Wood
0
 

Author Comment

by:afterburner
ID: 7157761
I dont get it. What is "MainDB"(RHS As String)








0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 28

Expert Comment

by:AzraSound
ID: 7157765
In the textbox example, the code for that Text property may look like this:


Public Property Let Text(RHS As String)
    m_strText = RHS
End Property


In your example, MainDB is the name of the property for this class, and RHS is the value passed to the property.  So, for example, any code using this class may do something like:


Dim c As New myClass
c.MainDB = "ABC"
0
 

Author Comment

by:afterburner
ID: 7157766
I know it literally means right hand side and left hand side and that these refer to expressions, but that does not seem to help me getting this concept straight I'm sorry to say. When the RHS is passed into this "function", where does it come from and what is it the right hand side of exactly?
0
 

Author Comment

by:afterburner
ID: 7157776
AzraSound
So would I be right in thinking then that to make a new property for an object, you state that you want to "set" a property first, and that doing so sets "a variable" to hold the value, and then Let assigns a value, and Get would retrieve it?
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 7157785
Yes, you use Set and Let to hold a local copy of the property value so that it can be retrieved later via a Get.  Set is used for properties that are, themselves, objects.
0
 

Author Comment

by:afterburner
ID: 7158214
azrasound
I cant understand the reasoning behind this stuff still, despite my earlier comment and your answer.

I cant seem to differentiate between what is supposed to be the property itself and what is the property's value. Neither can I see why a Set has to use an object, what kind of object that can be, and how the object gets _its_ value.
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 100 total points
ID: 7158577
In order to define a property for a class, you must use the Property Get/Let/Set statements.  A property can be read only, meaning you would only supply a Property Get.  A local copy of the property usually exists so that it can be saved for later retrieval.  Again, an example using a Text property:


Option Explicit

Private m_strText As String  'local copy

Public Property Get Text() As String
    Text = m_strTest   'return what is stored in the local copy
End Property

Public Property Let Text(ByVal RHS As String)
    m_strTest = RHS   'store the passed in, new value, into the local copy
End Property


Now you use set for properties that are objects, just like anytime in VB you use an object and need to set it to something else, e.g.,

Dim t As TextBox
Set t = Text1

Set t = Nothing


If you have a property that is an object, you use Property Set, e.g.,


Private m_objMyPic As StdPicture   'local copy

Public Property Set MyPicture(NewPic As StdPicture)
    Set m_objMyPic = NewPic
End Property
0
 

Author Comment

by:afterburner
ID: 7159109
Many thnx Azra.

I could not get the idea that Set was used for objects - first hurdle. Then the RHS thing was a bigger one but I can now see that it is as simple as being equal to the RHS of the assignment which happens through an implicit Let call back in the calling code. (Thought I'd repeat that to myself so it sinks in).

Best regards
aftrbrnr
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 7159458
Glad I could help   :-)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

721 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