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
   ► KBProgrammingVB.Net   Print This    All Groups  

VB.Net KB: VB.Net Topic


Topics

53 Articles Found in the VB.Net Topic  (or one of the sub-topics in bold above)

  KB Article    

Mike Prestwood
1. A 10 Minute VB.Net Console Application Quick Start

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

Posted to KB Topic: Tool Basics
9 years ago, and updated 6 years ago
(10 Comments , last by Anonymous )

Article
Nothing New Since Your Last Visit
33896
Hits

Mike Prestwood
2. A 10 Minute VB.Net Winforms Quick Start 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 to KB Topic: WinForms
9 years ago, and updated 9 years ago

Article
Nothing New Since Your Last Visit
7897
Hits

Bryan Valencia
3. ASP.NET Cheat Sheet

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

Posted to KB Topic: WebForms (ASP.Net)
7 years ago

KB Post
Nothing New Since Your Last Visit
5157
Hits

Stephen Berry
4. Associative Arrays in Visual Basic (a Dictionary)

An associative array links a set of keys to a set of values. In Visual Basic, associative arrays are implemented as Dictionaries.

This code produces a message box saying "Nevada."

Posted to KB Topic: Language Basics
9 years ago, and updated 9 years ago
(1 Comments , last by valeria.p )

Code
Nothing New Since Your Last Visit
17619
Hits

Mike Prestwood
5. Run a Program in VB.Net

How do you launch a Windows application in VB.Net? How do I open the default browser to a specific URL?

Posted to KB Topic: WebForms (ASP.Net)
8 years ago

FAQ
Nothing New Since Your Last Visit
9774
Hits

Wes Peterson
6. Telerik Extensions for ASP.NET MVC - Free http://www.telerik.com/products/aspnet-mvc.aspx?utm_source=CodeProjectNewsletter&utm_medium=banner&utm_campaign=MVC_Jan15
Posted to KB Topic: Tool Basics
7 years ago

Link
Nothing New Since Your Last Visit
6812
Hits

Mike Prestwood
7. VB.Net Abstraction (MustInherit, MustOverride, Overrides)

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 to KB Topic: OOP
9 years ago, and updated 8 years ago

Code

Article
Nothing New Since Your Last Visit
19308
Hits

Mike Prestwood
8. VB.Net Access Modifiers

In VB.Net, you specify each class and each class member's visibility with an access modifier preceding class or member. The VB.Net access modifiers are the traditional Public, Protected, and Private plus the two additional .Net modifiers Friend and Protected Friend.

Friend indicates members are accessible from types in the same assembly. Protected Friend indicates members are accessible from types in the same assembly as well as descendant classes. OO purist might object to Friend and Protected Friend and I suggest you avoid them until you both fully understand them and have a need that is best suited by them.

Posted to KB Topic: OOP
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit
8350
Hits

Mike Prestwood
9. VB.Net Assignment (=)

Languages Focus: Assignment

Common assignment operators for languages include =, ==, and :=. An assignment operator allows you to assign a value to a variable. The value can be a literal value like "Mike" or 42 or the value stored in another variable or returned by a function.

VB.Net Assignment

VB.Net uses = for it's assignment operator.

Posted to KB Topic: Tool Basics
9 years ago, and updated 9 years ago

Code
Nothing New Since Your Last Visit  
5118
Hits

Mike Prestwood
10. VB.Net Associative Array (Dictionary)

An associative array links a set of keys to a set of values. In Visual Basic, associative arrays are implemented as Dictionaries.

This code produces a message box saying "Nevada."

Posted to KB Topic: Language Basics
9 years ago, and updated 8 years ago
(2 Comments , last by Edward.W2 )

Code
Nothing New Since Your Last Visit  
14391
Hits

Mike Prestwood
11. VB.Net Base Class (System.Object)

In VB.Net, the Object keyword is an alias for the base System.Object class and is the single base class all classes ultimately inherit from.

Posted to KB Topic: OOP
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
8780
Hits

Mike Prestwood
12. VB.Net Case Sensitivity (No)

VB.Net is not case sensitive. If you type any other case for commands or variables, VB.Net will change it to the accepted or defined case. For example, if you type messagebox.show it is converted to MessageBox.Show.

9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
5337
Hits

Mike Prestwood
13. VB.Net Class..Object (Class..End Class..New)

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 to KB Topic: OOP
9 years ago, and updated 8 years ago

Code

KB Post
Nothing New Since Your Last Visit
9975
Hits

Mike Prestwood
14. VB.Net Code Blocks (End Xxx)

VB.Net, like VBClassiccode blocks, are surrounded by statement ending keywords that all use End such as End Class, End Sub, End Function, End If, and End If.

9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit
11776
Hits

Mike Prestwood
15. VB.Net Comments (' or REM)

Languages Focus: Comments

Commenting code generally has three purposes: to document your code, for psuedo coding prior to coding, and to embed compiler directives. Most languages support both a single line comment and a multiple line comment. Some languages also use comments to give instructions to the compiler or interpreter.

VB.Net Comments

Commenting Code
VB.Net, like all the VB-based languages, uses a single quote (') or the original class-style basic "REM" (most developers just use a quote). VB.Net does NOT have a multiple line comment.

Posted to KB Topic: Tool Basics
9 years ago, and updated 8 years ago
(1 Comments , last by Anonymous )

Code
Nothing New Since Your Last Visit  
17553
Hits

Mike Prestwood
16. VB.Net Comparison Operators (=, <>)

Same as VB Classic.

Posted to KB Topic: Language Basics
8 years ago

Code
Nothing New Since Your Last Visit  
8590
Hits

Mike Prestwood
17. VB.Net Constants (Const kPI Double = 3.1459)

In VB.Net, you define constants with the Const keyword.

All constants are part of a class (no global constants) but you can make a constant public and have access to it using ClassName.ConstantName so long as you have added the class to the project. This works even without creating the class as if the public constants were static, but you cannot use the Shared keyword.

Constants must be of an integral type (sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool, or string), an enumeration, or a reference to null.

Posted to KB Topic: Tool Basics
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
9101
Hits

Mike Prestwood
18. VB.Net Constructors (New)

 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 to KB Topic: OOP
8 years ago

Code

KB Post
Nothing New Since Your Last Visit  
11345
Hits

Mike Prestwood
19. VB.Net Custom Routines (Sub, Function)

VB.Net is a fully OOP language so both Subs and Functions are methods of a class. A Sub does not return a value while a Function does.

Posted to KB Topic: Language Basics
9 years ago, and updated 9 years ago

Code
Nothing New Since Your Last Visit  
4849
Hits

Mike Prestwood
20. VB.Net Deployment Overview

VB.Net projects require the .Net framework and any additional dependencies you've added such as Crystal Reports.

In Visual Studio.Net, you can create a Setup and Deployment project by using any of the templates available on the New Project dialog (Other Project Types).

In addition, VB.Net projects also support ClickOnce which brings the ease of Web deployment to Windows Forms and console applications. To get started, right click on your solution in the Solution Explorer, click Properties then select the Security tab. 

In addition, you can use any of the many free and commercially available installation packages.

Posted to KB Topic: Tool Basics
8 years ago
(1 Comments , last by Anonymous )

Code
Nothing New Since Your Last Visit  
6459
Hits

Mike Prestwood
21. VB.Net Development Tools

Languages Focus: Development Tools

Primary development tool(s) used to develop and debug code.

VB.Net Development Tools

Microsoft Visual Basic Express Editions (as in Visual Basic 2008 Express Edition) and the full version of Microsoft Visual Studio.Net are the current primary tools. VB.Net is not compatible with VB Classic.

Posted to KB Topic: Tool Basics
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
5918
Hits

Mike Prestwood
22. VB.Net Empty String Check (String.IsNullOrEmpty)

The .Net framework offers a static method in the string class: String.IsNullOrEmpty.

8 years ago

Code
Nothing New Since Your Last Visit  
12257
Hits

Mike Prestwood
23. VB.Net End of Statement (Return)

Languages Focus: End of Statement

In coding languages, common End of statement specifiers include a semicolon and return (others exist too). Also of concern when studying a language is can you put two statements on a single code line and can you break a single statement into two or more code lines.

VB.Net End of Statement

A return marks the end of a statement and you cannot combine statements on a single line of code. You can break a single statement into two or more code lines by using a space and underscore " _".

Posted to KB Topic: Tool Basics
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
5438
Hits

Mike Prestwood
24. VB.Net Exception Trapping (Try...Catch...Finally)

A common usage of exception handling is to obtain and use resources in a "try-it" block, deal with any exceptions in an "exceptions" block, and release the resources in some kind of "final" block which executes whether or not any exceptions are trapped.

Posted to KB Topic: Language Basics
9 years ago, and updated 9 years ago
(1 Comments , last by Anonymous )

Code
Nothing New Since Your Last Visit  
8974
Hits

Mike Prestwood
25. VB.Net File Extensions

Common source code file extensions include:

  • .SLN - Solution File. Contains solution specific information such as links to the projects within this solution.
  • .VBPROJ - VB.Net Project File. Contains project specific information.
  • .VB -VB.Net source file.
  • .Designer.VB -VB.Net form file (a text resource file).
8 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit
5303
Hits

Mike Prestwood
26. VB.Net Finalizer (Finalize())

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 to KB Topic: OOP
8 years ago, and updated 8 years ago

Code

Article
Nothing New Since Your Last Visit  
14047
Hits

Mike Prestwood
27. VB.Net If Statement (If..ElseIf..Else..End If)

Same as VB classic.

9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
5962
Hits

Mike Prestwood
28. VB.Net Inheritance (Inherits ParentClass)

VB.Net uses the Inherits keyword followed by the parent class name. If you do not include Inherits, your class inherits from System.Object.

Posted to KB Topic: OOP
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
8362
Hits

Mike Prestwood
29. VB.Net Inheritance-Multiple (Not Supported)

VB.Net does not support multiple implementation inheritance. Each class can have only one parent class (a single inheritance path). In VB.Net, you can use multiple interface usage to design in a multiple class way horizontally in a class hierarchy.

Posted to KB Topic: OOP
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit
4583
Hits

Mike Prestwood
30. VB.Net Inlining (Automatic)

In VB.Net, inlining is automatically done for you by the JIT compiler for all languages and in general leads to faster code for all programmers whether they are aware of inlining or not.

Posted to KB Topic: Language Details
8 years ago

Code
Nothing New Since Your Last Visit  
5736
Hits

Mike Prestwood
31. VB.Net Interfaces (Interface, Implements)

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 to KB Topic: OOP
9 years ago, and updated 8 years ago

Code

Article
Nothing New Since Your Last Visit
10369
Hits

Mike Prestwood
32. VB.Net Left of Substring (Left or Substring)

The above usage of Left and Substring are equivalent.

Left is a traditional VB approach popular with developers moving from VB Classic to VB.Net. Substring is considered the .Net way of doing string manipulation.

9 years ago, and updated 9 years ago

Code
Nothing New Since Your Last Visit
22991
Hits

Mike Prestwood
33. VB.Net Literals (quote)

General Info: Programming Literals

A value directly written into the source code of a computer program (as opposed to an identifier like a variable or constant). Literals cannot be changed. Common types of literals include string literals, floating point literals, integer literals, and hexidemal literals. Literal strings are usually either quoted (") or use an apostrophe (') which is often referred to as a single quote. Sometimes quotes are inaccurately referred to as double quotes.

Languages Focus: Literals

In addition to understanding whether to use a quote or apostrophe for string literals, you also want to know how to specify and work with other types of literals including floating point literals. Some compilers allow leading and trailing decimals (.1 + .1), while some require a leading or trailing 0 as in (0.1 + 0.1). Also, because floating point literals are difficult for compilers to represent accurately, you need to understand how the compiler handles them and how to use rounding and trimming commands correctly for the nature of the project your are coding.

VB.Net Literals

String literals are quoted as in "Prestwood". If you need to embed a quote use two quotes in a row.

To specify a floating point literal between 1 and -1, preceed the decimal with a 0. If you don't, the compiler will auto-correct your code and place a leading 0. It will change .1 to 0.1 automatically. Trailing decimals are not allowed.

Posted to KB Topic: Tool Basics
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
8075
Hits

Mike Prestwood
34. VB.Net Logical Operators

VB.Net logical operators:

And and, as in this and that
Or or, as in this or that
Not Not, as in Not This
Xor either or, as in this or that but not both

Posted to KB Topic: Language Basics
8 years ago

Code
Nothing New Since Your Last Visit  
6719
Hits

Mike Prestwood
35. VB.Net Member Field

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 to KB Topic: OOP
9 years ago, and updated 8 years ago

Code

Article
Nothing New Since Your Last Visit
7655
Hits

Mike Prestwood
36. VB.Net Member Method (Sub, Function)

VB.Net uses the keywords sub and function. A sub does not return a value and a function does. Many programmers like to use the optional call keyword when calling a sub to indicate the call is to a procedure.

Posted to KB Topic: OOP
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit
5758
Hits

Mike Prestwood
37. VB.Net Member Modifiers

The method modifiers include MustOverride, NotOverridable, Overridable, Overrides. Specify VB.Net member modifiers as follows:

Public Overrides Function SomeFunction() As Double

The field modifiers include ReadOnly and Shared. Specify field modifiers as follows:

Public ReadOnly SomeField As String

Posted to KB Topic: OOP
8 years ago

Code
Nothing New Since Your Last Visit
6167
Hits

Mike Prestwood
38. VB.Net Member Property (property, get, set)

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 to KB Topic: OOP
9 years ago, and updated 8 years ago

Code

KB Post
Nothing New Since Your Last Visit
16752
Hits

Mike Prestwood
39. VB.Net Overloading (Overloads, or implicit)

VB.Net supports both method and operator overloading.

For method overloading, you either use implicit overloading (no special syntax like C#) or use the Overloads keyword. If you use the Overloads keyword, all overloaded methods with the same name in the same class must include the Overloads keyword.

Posted to KB Topic: Language Basics
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
9107
Hits

Mike Prestwood
40. VB.Net Overriding (Overridable, Overrides)

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 to KB Topic: OOP
8 years ago

Code

Article
Nothing New Since Your Last Visit
20411
Hits

Mike Prestwood
41. VB.Net Overview and History

Language Overview: VB.Net is an OOP language (no global functions or variables). You code using a fully OOP approach (everything is in a class).

Target Platforms: VB.Net is most suitable for creating any type of application that runs on the .Net platform. This includes desktop business applications using WinForms and websites using WebForms.

Posted to KB Topic: Tool Basics
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit
4824
Hits

Mike Prestwood
42. VB.Net Parameters (ByVal, ByRef)

By Reference or Value
For parameters, you can optionally specify ByVal or ByRef. ByVal is the default if you don't specify which is changed from VB Classic (in VB Classic, ByRef was the default).

9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
5402
Hits

Mike Prestwood
43. VB.Net Partial Classes (Partial)

VB.Net supports both partial classes and partial methods.

Posted to KB Topic: OOP
8 years ago

Code

Article
Nothing New Since Your Last Visit
10187
Hits

Mike Prestwood
44. VB.Net Pointers (None)

VB.Net doesn't support pointers. The closest it comes is IntPtr which you use to get pointer handles on windows, files, etc.

C# does have better support for pointers and C++/CLI has extensive support. One solution when it's really needed in VB.Net is to code in C# or C++/CLI and add it to your project.

However, VB.Net does support references.

Posted to KB Topic: Language Details
8 years ago

Code
Nothing New Since Your Last Visit  
7083
Hits

Mike Prestwood
45. VB.Net Polymorphism

C# supports the following types of polymorphism:

Posted to KB Topic: OOP
8 years ago

Code
Nothing New Since Your Last Visit
7620
Hits

Mike Prestwood
46. VB.Net Prevent Derivation (NotInheritable, NotOverridable)

With VB.Net, use the NotInheritable keyword to prevent a class from being inherited from and use the NotOverridable keyword to prevent a method from being overridden.

A method marked NotOverridable must override an ancestor method. If you mark a class NotInheritable, all members are implicitly not overridable so the NotOverridable keyword is not legal.

Posted to KB Topic: OOP
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit
10059
Hits

Mike Prestwood
47. VB.Net Report Tools Overview

Microsoft includes ReportViewer Starting with Visual Studio 2005. You can even surface this .Net solution in your VB Classic application if you wish. For WebForm applications the client target is the browser (a document interfaced GUI), a common solution is to simply output an HTML formatted page with black text and a white background (not much control but it does work for some situations). For WinForm applications, Crystal Reports is still very popular with VB.Net developers because it has been bundled with Visual Basic since VB 3, it's overall popularity, and compatibility with many different development tools.

Posted to KB Topic: Tool Basics
9 years ago, and updated 9 years ago

Code
Nothing New Since Your Last Visit
7071
Hits

Mike Prestwood
48. VB.Net Self Keyword (Me)

To refer to the current instance of a class or structure, use the Me keyword. Me provides a way to refer to the specific instance in which the code is currently executing. It is particularly useful for passing information about the currently executing instance.

The Me keyword is also used as a modifier of the first parameter of an extension method.

You cannot use Me with static method functions because static methods do not belong to an object instance. If you try, you'll get an error.

Posted to KB Topic: OOP
8 years ago

Code
Nothing New Since Your Last Visit  
8074
Hits

Mike Prestwood
49. VB.Net Shared Members (Shared)

VB.Net supports both static members and static classes (use the keyword Shared). You can add a static method, field, property, or event to an existing class.

You can designate a class as static and the compiler will ensure all methods in that class are static. You can add a constructor to a static class to initialize values.

The CLR automatically loads static classes with the program or namespace.

Posted to KB Topic: OOP
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
7466
Hits

Mike Prestwood
50. VB.Net String Concatenation (+ or &)

Most (many?) developers recommend using "+" because that's what C# uses but "&" is also available and many VB Classic and VBA/ASP developers prefer it. My preference is to use the & because it offers implicit type casting.

Posted to KB Topic: Tool Basics
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit
6049
Hits

Mike Prestwood
51. VB.Net Unary Operators

An operation with only one operand (a single input). The following are the�VB.Net unary operators: +, -, isFalse, isTrue, and Not. A unary operator method can return any type but takes only one parameter, which must be the type of the containing class.

Posted to KB Topic: Language Basics
9 years ago, and updated 8 years ago
(2 Comments , last by Anonymous )

Code
Nothing New Since Your Last Visit
11094
Hits

Mike Prestwood
52. VB.Net Variables (Dim x As Integer=0)

Variables are case sensitive but VS.Net will auto-fix your variable names to the defined case. You can declare variables in-line wherever you need them and declarative variable assignment is supported.

Posted to KB Topic: Tool Basics
9 years ago, and updated 8 years ago

Code
Nothing New Since Your Last Visit  
7297
Hits

Icon Legend:
Recent or not:
- Recent activity (within last two weeks).
- No activity last two weeks.
 Since your last logged visit:
- New to you or updated since your last visit (sign in now to activate).
- NOT new to you since your last visit (sign in now to activate).

New VB.Net Language Knowledge Base Post...

Share your knowledge with the WORLD! In addition to adding comments to existing posts, you can post knowledge you've acquired. We welcome full articles (intro with screen shots), general posts (shorter), and tidbits (tips, FAQs, definitions, etc.).

Post New...

Tidbit Post: Short Flashcard FAQ Definition Quick Tip Code Snippet
Longer Post: Full Article General Post File Link Error News
Other: Blog Topic
Or, if YOU have a question...
  VB.Net Language Message Board
-
   Contact Us!
 
PrestwoodBoards.com was developed and is maintainted by me. Do you have a question or suggestion? Do you see a problem? Contact me now. My goal is to build an ad-free and spam-free source of I.T. information with many contributers (ok to promote your website/company in your bio). Yes, my company Prestwood IT Solutions is mentioned in my bio which shows with every post, but you can contribute and promote your pet project too!

1,596 People Online Now!!  
Sign In to see who's online now!  Not a member? Join now. It's free!
Show more stats...


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