I.T. Discussion Community!
-Collapse +Expand
VB.Net
Search VB.Net Group:

Advanced
-Collapse +Expand VB.Net To/From
To/FromCODEGuides
-Collapse +Expand VB.Net Store
PRESTWOODSTORE

Prestwood eMagazine

November Edition
Subscribe now! It's Free!
Enter your email:

   ► KBVB.Net Knowledge Base  Print This    All Groups  

VB.Net Language Tech Articles

These Articles are contributed by you (our online community members). They are organized by our knowledge base topics. Specifically, by the VB.Net sub-topics.

Contribute an Article

13 VB.Net Language Articles

Group: VB.Net Language


Topic: Tool Basics

This will show how to make a "hello world" console application in Visual Studio 2008 using VB.Net.

Posted By Mike Prestwood, Post #101325, KB Topic: Tool Basics
  +Add Comment  (5 Comments)




Topic: OOP

VB.Net supports abstract class members and abstract classes using the MustInherit and MustOverride modifiers.An abstract class is indicated with a MustInherit modifier and is a class with one or more abstract members and you cannot instantiate an abstract class. However, you can have additional implemented methods and properties. An abstract member is either a method (implicitly virtual), property, indexer, or event in an abstract class. You can add abstract members ONLY to abstract classes using the MustOverride keyword. Then you override it in a descendant class with Overrides.

Posted By Mike Prestwood, Post #101348, KB Topic: OOP
  +Add Comment  (1 Comments)

Declare and implement VB.Net classes after the form class or in their own .vb files. Unlike VB Classic, you can have more than one class in a .vb class file (VB classic uses .cls files for each class).

Posted By Mike Prestwood, Post #101406, KB Topic: OOP
  +Add Comment

 A sub named New. You can overload the constructor simply by adding two or more New subs with various parameters.

Public Class Cyborg
Public CyborgName As String
  
  Public Sub New(ByVal pName As String)
CyborgName = pName
End Sub
End Class
Posted By Mike Prestwood, Post #101820, KB Topic: OOP
  +Add Comment

Use a destructor to free unmanaged resources. A destructor is a method with the same name as the class but preceded with a tilde (as in ~ClassName). The destructor implicity creates an Object.Finalize method (you cannot directly call nor override the Object.Finalize method).

In VB.Net you cannot explicitly destroy an object. Instead, the .Net Frameworks garbage collector (GC) takes care of destroying all objects. The GC destroys the objects only when necessary. Some situations of necessity are when memory is exhausted or you explicitly call the System.GC.Collect method. In general, you never need to call  System.GC.Collect.

Posted By Mike Prestwood, Post #101835, KB Topic: OOP
  +Add Comment  (2 Comments)

With VB.Net you define an interface with the Interface keyword and use it in a class with the Implements keyword. In the resulting class, you implement each property and method and add Implements Interface.Object to each as in:

Sub Speak(ByVal pSentence As String) Implements IHuman.Speak
  MessageBox.Show(pSentence)
End Sub
Posted By Mike Prestwood, Post #101443, KB Topic: OOP
  +Add Comment

In VB.Net you can set the visibility of a member field to any visibility: private, protected, public, friend or protected friend.

You can intialize a member field with a default when declared. If you set the member field value in your constructor, it will override the default value.

Finally, you can use the Shared modifier (no instance required) and ReadOnly modifier (similar to a constant).

Posted By Mike Prestwood, Post #101761, KB Topic: OOP
  +Add Comment

VB.Net uses a special property keyword along with special get and set methods to both get and set the values of properties. For a read-only property, leave out the set method. The value keyword is used to refer to the member field. Properties can make use of any of the access modifiers (private, protected, etc).

My preference for VB.Net code is to start member fields with "F" ("FName" in our example) and drop the "F" with properties that manage member fields ("Name" in our example).

Posted By Mike Prestwood, Post #101741, KB Topic: OOP
  +Add Comment

In VB.Net, you specify a virtual method with the Overridable keyword in a parent class and extend (or replace) it in a descendant class using the Overrides keyword.

Use the base keyword in the descendant method to execute the code in the parent method, i.e. base.SomeMethod().

Posted By Mike Prestwood, Post #101947, KB Topic: OOP
  +Add Comment

VB.Net supports both partial classes and partial methods.

Posted By Mike Prestwood, Post #101857, KB Topic: OOP
  +Add Comment




Topic: WebForms (ASP.Net)

Here's some copy-and-paste code that I use weekly.  Bookmark it and save yourself hours!

Posted By Bryan Valencia, Post #102188, KB Topic: WebForms (ASP.Net)
  +Add Comment

This article provides a simple and free means of experimenting with ASP.NET

Posted By Kim Berry, Post #100082, KB Topic: WebForms (ASP.Net)
  +Add Comment




Topic: WinForms

The ButtonsVB project. Create a classic "Hello, World" application using Visual Studio .Net with VB.Net syntax. Requires either the full version or VB.Net Express Edition.
Posted By Mike Prestwood, Post #101213, KB Topic: WinForms
  +Add Comment  (2 Comments)


Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech