Visual Basic - Net (VB - Net) - Cheat Sheets - OneCompiler
Visual Basic - Net (VB - Net) - Cheat Sheets - OneCompiler
Basics
Sample Program
Console.WriteLine("Hello, World!")
End Sub
End Module
Public Module : Every program contains a module which has the data and
procedures that your program uses. Here we are declaring module named
Program with public visibility.
Main : Beginning of your program
Console.WriteLine : Console is a class of the System namespace and WriteLine() is
a method in it which is used to print text to the console.
VB.net is not a Case-sensitive language
' : Single line Comment
Data types
Variables
Example
Constants
attributeList − attributeList is optional where you can specify the list of attributes
applied to the constants.
Shadows − shadows is also optional which makes the constant hide a programming
element of identical name.
https://onecompiler.com/cheatsheets/vb 2/7
9/27/21, 11:45 AM Visual Basic.net(VB.net) - Cheat Sheets - OneCompiler
Operators
BitWise Operator AND, OR, XOR, NOT, AndAlso, OrElse, isTrue, isFalse
Strings
Conditional Statements
1. If
If condition-expression Then
'code
End If
2. If-else
If(conditional-expression)Then
Else
End If
3. If-else-if ladder
If(conditional-expression)Then
Else
https://onecompiler.com/cheatsheets/vb 3/7
9/27/21, 11:45 AM Visual Basic.net(VB.net) - Cheat Sheets - OneCompiler
Else
End If
4. Nested-If
If(conditional-expression)Then
If(conditional-expression)Then
End If
End If
5. Select Case
[ Case expressionlist
'code ]
[ Case Else
'code ]
End Select
Loops
1. For..Next
'code
[ Continue For ]
'code
[ Exit For ]
'code
Next [ counter ]
2. For..Each
'code
[ Continue For ]
'code
[ Exit For ]
'code
Next [ element ]
3. While
'Code
[ Continue While ]
'Code
[ Exit While ]
'Code
End While
4. Do-while
'Code
[ Continue Do ]
'Code
[ Exit Do ]
'Code
Loop
Do
'Code
[ Continue Do ]
'Code
[ Exit Do ]
'Code
Functions
Functions consists of a set of statements which perform a sepcific functionality and they
return a value when they are called.
'code
End Function
Sub-Procedures
Sub-procedures are similar to functions but they don't return any value.
'Code
End Sub
https://onecompiler.com/cheatsheets/vb 5/7
9/27/21, 11:45 AM Visual Basic.net(VB.net) - Cheat Sheets - OneCompiler
OneCompiler.com
About
Contact
Users
Status
GitHub
LinkedIn
Facebook
Instagram
Twitter
Languages
Java Python
C C++
NodeJS JavaScript
Groovy JShell
Haskell Tcl
Lua Ada
CommonLisp D
Elixir Erlang
F# Fortran
Assembly Scala
Php Python2
C# Perl
Ruby Go
R Racket
OCaml Visual Basic (VB.NET)
HTML Materialize
Bootstrap Foundation
Bulma Uikit
Semantic UI Skeleton
https://onecompiler.com/cheatsheets/vb 6/7
9/27/21, 11:45 AM Visual Basic.net(VB.net) - Cheat Sheets - OneCompiler
Milligram PaperCSS
Bash Clojure
TypeScript Cobol
Kotlin Pascal
Prolog Rust
Swift Octave
MySQL SQLite
More
Cheatsheets
Tutorials
Tools
Stats
© Copyright 2021 One Compiler Pvt. Ltd. | Privacy Policy | Terms & Conditions
https://onecompiler.com/cheatsheets/vb 7/7