TechArena Community

TechArena Community (http://forums.techarena.in/)
-   Software Development (http://forums.techarena.in/software-development/)
-   -   What is the use of Classes and objects in Visual basic? (http://forums.techarena.in/software-development/1384112.htm)

Palnila 02-01-2011 07:16 AM

What is the use of Classes and objects in Visual basic?
 
Hey Guys, Can somebody tell me what the use of Classes and objects in Visual basic 6.0? I don?t have much knowledge about Visual basic 6.0 but still I am not able link the concept of Classes and objects in visual basic. I am not able to find any link in it. But, I am not sure about it. If there is any link than please let me know what are the links which connects Classes and objects in visual basic 6.0? If anyone who has any information about this than please let me know as soon as possible.

Vandam 02-01-2011 07:18 AM

Re: What is the use of Classes and objects in Visual basic?
 
A class is a collection of properties and methods. It just defines the structure of an object and is useless unless its objects are created. To create class in Visual Basic, you must add a class module which can be done by selecting Add Class Module from the Project menu. Defining the Properties. Properties are the characteristics of an object. Variables declared in the class module are the properties of that class. One way to define the properties is to make all the variables Public. But this is not a good practice since it violates encapsulation. Another way to define properties is to make all the variables Private and use Property Let and Property Get Procedures to store and retrieve the values in the variables respectively.

Villiers 02-01-2011 07:18 AM

Re: What is the use of Classes and objects in Visual basic?
 
Property Let Procedure Syntax Public Property Let ProcedureName([OptionalArgumentList, ] IncomingValue [As DataType]) [statements in procedure] PropertyName = IncomingValueEnd Property Explanation. It is used to assign value to a property. Validation can be performed on the Incoming Value before assigning it to the property. ProcedureName can be any valid identifier and becomes the name of the property for the outside world. If arguments as included, the number of arguments, their data type and order must exactly match the argument list in the Property Let procedure. If arguments are included, the incoming value must always follow the list.

Steyn 02-01-2011 07:19 AM

Re: What is the use of Classes and objects in Visual basic?
 
The data type of the incoming value and the data type of the return value of the corresponding Property Get procedure must be same. Example Public Property Let Last Name (strLastNameValue As String) mstrLastName = strLastNameValue End Property B. Property Get Procedure Syntax [Public|Private] Property GetProcedureName([OptionalArgumentList]) [As DataType] [statements in procedure] ProcedureName = PropertyNameEnd Property.


All times are GMT +5.5. The time now is 03:12 AM.