Cheat Sheet

Visual Basic.NET All-in-One Desk Reference For Dummies

Visual Basic.NET helps even those with no programming experience write sophisticated programs for Windows with ease. Becoming familiar with the Visual Basic.NET naming conventions and data types sets you on the road to programming whatever you like, and discovering the shortcut keys the VB.NET editor gets you to your destination even faster.

Standardized Naming Conventions for Visual Basic .NET

When you’re programming, names are important. If you’re programming with Visual Basic .NET, the following table can be a major help in getting the names right. It gives the common prefix to use when naming objects so you can quickly tell your check boxes from your combo boxes and your radio buttons from your record sets.

Prefix Corresponding Object Example Prefix Corresponding Object Example
Acd ActiveDoc AcdMainPage Hpl HyperLink HplURL
Chk CheckBox ChkBoldface Lbl Label LblContents
Cbo ComboBox CboDropper Lst ListBox LstNames
Cm ADO command (database) CmMyCommand Pag Page PagTurn
Cmd CommandButton CmdExit Pgf PageFrame PgfRule
Cmg CommandGroup CmgSelectOne Prj ProjectHook PrjSuzerine
Cn Connection (database) CnMyConnex Rb RadioButton RbBlueBackground
Con Container CntFramed Rs Recordset (database) RsTotalSales
Ctr Control CtlSeeThis Sep Separator SepZone
Fld Field (database) FldTitles Spn Spinner SpnWatch
Frm Form FrmColors Txt TextBox TxtAddress
Frs FormSet FrsTypeIn Tmr Timer TmrAnimation
Grd Grid GrdGoods Tbr ToolBar TbrDropThis
Grc Column (in grid) GrcQuantity Tbl Table (database) TblTitles
Grh Header (in grid) GrhYearsResults

Shortcut Keys for the Visual Basic .NET Editor

Visual Basic .NET not only helps you program like a pro even if you have no programming experience at all, it offers many handy tools to help. One of those tools is a whole range of shortcut keys you can use to cut, copy, and generally direct a program to do what you want it to. The command names, functions, and the shortcut keys are in the following table.

Command Name Shortcut Keys Behavior
Edit.Copy Ctrl + C
Ctrl + Insert
Copies the currently selected item to the Clipboard.
Edit.Cut Ctrl + X
Shift + Delete
Removes the currently selected item, but saves a copy in the Clipboard in case you want to paste it somewhere.
Edit.GoToNextLocation F8 Moves the cursor to the next item.
Edit.GoToPreviousLocation Shift + F8 Moves the cursor to the previous item.
Edit.GoToReference Shift + F12 Displays the reference of the selection in the code window.
Edit.OpenFile Ctrl + Shift + G Displays the Open File dialog box.
Edit.Paste Ctrl + V
Shift + Insert
Pastes the contents of the Clipboard at the insertion point.
Edit.Redo Ctrl + Shift + Z
Ctrl + Y
Shift + Alt + Backspace
Restores the previously undone action.
Edit.SelectionCancel Esc Cancels the current operation or closes a dialog box.
Edit.Undo Alt + Backspace
Ctrl + Z
Reverses the last editing action.
File.Print Ctrl + P Displays the Print dialog box so you can specifiy printer settings.
File.SaveAll Ctrl + Shift + S Saves all documents in the current solution.
File.SaveSelectedItems Ctrl + S Saves all documents in the current solution.
Tools.GoToCommandLine Ctrl + / Places the caret in the Find/Command box on the Standard toolbar.
View.NextTask Ctrl + Shift + F12 Moves to the next task in the Task List window.
View.ViewCode F7 Displays the selected file (in Solution Explorer) in the Code Editor window.
View.ViewDesigner Shift + F7 Displays the selected file in the Design. (Simply double-clicking the filename in Solution Explorer is easier.)
View.WebNavigateBack Alt + left-arrow Displays the previous page in the viewing history.
View.WebNavigateForward Alt + right-arrow Displays the next page in the viewing history.

Visual Basic .NET Data Types

Visual Basic .NET (VB .NET) lets you get right to the basics without having to wade through translators. The following table shows you the data types VB .NET uses, as well as their CLR structure, storage size, and value ranges. Use the info for good, not evil!

Visual Basic Type Common Language Runtime Type Structure Storage Size Value Range
Boolean System.Boolean 2 bytes True or False
Byte System.Byte 1 byte 0 to 255 (unsigned)
Char System.Char 2 bytes 0 to 65535 (unsigned)
Date System.DateTime 8 bytes January 1, 0001 to December 31, 9999
Decimal System.Decimal 16 bytes +/-79,228,162,514,264,337,593,543,950,335 with no decimal point; +/-7.9228162514264337593543950335 with 28 places to the right of the decimal; smallest non-zero number is +/-0.0000000000000000000000000001
Double (double- precision floating-point) System.Double 8 bytes -1.79769313486231E+308 to 4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486231E+308 for positive values
Integer System.Int32 4 bytes -2,147,483,648 to 2,147,483,647
Long (long integer) System.Int64 8 bytes -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Object System.Object (class) 4 bytes Any type can be stored in a variable of type Object
Short System.Int16 2 bytes -32,768 to 32,767
Single (single-precision floating-point) System.Single 4 bytes -3.402823E+38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E+38 for positive values
String (variable-length) System.String (class) Depends on implementing platform 0 to approximately 2 billion Unicode characters
User-Defined Type (structure) (inherits from System.ValueType) Sum of the sizes of its members Each member of the structure has a range determined by its data type and independent of the ranges of the other members
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.