Free Source Code and Tutorials

Custom Search


What is a class? A Class is a group of object that defines its functionality as a set of properties and the methods that will respond to. And it is also a container of your data and code. Wherein you can limit the data that you’re accessing. In Object-Oriented Programming(OOP) , classes, methods and properties help you create a complete application.


This is the example on how to use a class in the application.

  • Open the Visual Basic, select “File” on the menu, hit new and create a new project.
  • The New Project dialog will appear.
    Select “windows” in the project types, hit the “windows form application” in the templates and hit “ok“.
  • Go to the solution explorer. Right click the application, click add and select a class
  • The add new Item dialog will appear and do the process like what is shown below.
  • Design the form just like shown below.

  • Select Lines(class) and add this following code:
  1. Private lenLines As String
  3. Property Lines() As String
  4. Get
  5. Return lenLines
  6. End Get
  7. Set(ByVal Value As String)
  8. lenLines = Value
  9. End Set
  10. End Property
  12. ReadOnly Property Length() As Integer
  13. Get
  14. Return lenLines.Length
  15. End Get
  16. End Property
  • Go to the form design and double click a button to fire the click event handler of it. Add this following code in the method.
  1. Dim oLine As Lines
  3. oLine = New Lines()
  5. oLine.Lines = txtlines.Text
  6. txtlen.Text = oLine.Length.ToString()




Facebook Comments
(Visited 11 times, 1 visits today)
Share this

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked * © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!

%d bloggers like this: