Professional Documents
Culture Documents
Com Prog
Com Prog
Start Page contains a set of links, MSDN articles and Project Options. A comprehensive source of information about your project, as well as
resources within the Visual Basic development community
Toolbox
Contains controls and other component that can be placed on the form designer.
Solution Explorer Window
Provides you with a way to navigate through your program's structure, with entries for each form, module, and class, along with supporting files
such as the application configuration file.
Properties Window
Describes the properties or characteristics of the form and other controls.
Performing calculations
Operators:
o + is addition
o – is subtraction
o * MOD gets remainder
o / is *floating point division
o \ is *integer division
o *^ is exponentiation
Examples:
Integers = 5 + 5
Integers = 5 MOD 5
{remainder shows)
Integer = 5 / 5
The following are symbols for declaring specific operations
Mathematical Operation Operator or Symbol Mathematical Notation Example Result
Addition + a+b 17+2 19
Subtraction - a-b 2-17 -15
Multiplication * a*b 2*17 34
Division / a/b 17/1 17
Exponentiation ^ a^b 7^2 49
+ or & String Concatenations String 1 + String2 or "Hello" + "World" Hello World
String1 & String2
mod Reminder of division a mod b 19mod3 1
RELATIONAL OPERATORS
Operators Description Mathematical Notation Example Result
> Greater than a>b 25>2 True
< Less than a<b 25<5 False
>= Greater than or equal to a>=b 83>-75 True
<= Less than or equal to a<=b 83<-75 False
<> Not equal a<>b Password <> computer True
= Equal a=b Password = computer False
LOGICAL OPERATORS
Operators Description Example Result
OR It will retrieve true value if the (25>3) OR (3<5) True
operand are true.
AND It will retrieve true value only (25>3) AND (3<5) True
if both operands are true
XOR Both must not be true meaning (25>3) XOR (3<5) False
only one side should hold true
value
NOT Reverse true side NOT (2=2) False
2. Nonnumeric — usually consists of characters, date, Boolean data or variant data types.
Example:
a) String — is a series of characters which may range from zero or more characters. It may hold numeric characters but it is never used
for calculations.
b) Date — used for dates.
c) Boolean data — only holds two value or no, true or false.
d) Variant — data that cam holding any kinds of data except for fixed length strings.
EXPLICIT Declarations
It is advisable to declare all variables before they are used in a program.
Using the DIM statement to declare variables by assigning them a name and a data type. Below is the format of the DIN'I statement in a variable
declaration.
Dim Varname as Data Type
Varname is the name you assign to a variable and the
Data type is the type of data that the variable will hold.
EXPLICIT Declarations
Like giving names in a control, variables also used prefixes in assigning names to them. Below are the variable name prefixes that describe
variables data type.
Example
*Dim anlntegerAs Integer = 54
MsgBox (CStr(anlnteger))
This will convertanlnteger= 54
to output as a string "54"
VB Default Controls
List Box, Combo Box
Default Controls
- Pointer
- Picture Box
- Label
- Text Box
- Frame
- Command Box
- Checkbox
- Option Button
- Combo box
- List box
- Horizontal box
- Vertical scroll Bar
- Timer
- Drive List Box
- Directory list box
- File list box
- Shape
- Line
- Image
- Data
ADD ITEM
Combobox1.items.add("January") = Constant variable
Combobox1.items.add("textbox.text") = Indefinite Variable
3 CheckAlign
Gets or sets the location of the check box portion of the radio button.
4 Checked
Gets or sets a value indicating whether the control is checked.
5 Text
Gets or sets the caption for a radio button.
PICTURE BOX
• Picture box is a control in Visual Basic that is used to display images
CheckBox Properties
Property Description
DefauIt It is used to get the default size of the checkbox.
AutoCheck The AutoCheck property is used to check whether the checked value or appearance of control can be automatically changed
when the user clicked on the CheckBox control.
CheckAlign It is used to set the checkmark's alignment. such as horizontal or vertical on the checkbox.
Appearance The Appearance property is used to display the appearance of a checkbox control by setting a value.
CheckState The CheckState property is used to verify whether the checkbox status is checked in the window form.
ThreeState The ThreeState property is used to check whether the control allows one to set three check positions instead of two by
setting values.
FlatStyle It is used to obtain or set the flat appearance of a checkbox.
VB PART 6
LISTVIEW
The ListView control is used to display a list of items. Along with the TreeView control, it allows you to create a Windows Explorer
like interface.
Let's click on a ListView control from the Toolbox and place it on the form.
The ListView control displays a list of items along with icons. The Item property of the ListView control allows you to add and
remove items from it. The SelectedItem property contains a collection of the selected items. The MultiSelect property allows you to set
select more than one item in the list view. The CheckBoxes property allows you to set check boxes next to the items.
Properties of the ListView Control
The following are some of the commonly used properties of the ListView control –
This part of VB GUI, Describes the properties or characteristics of the form and other controls.
Properties Window
This part of VB GUI, Design space that contains objects or Controls *
Toolbox
File extension of "Project Files" in VB.Net *
.vb
Give one COMMON property of a FORM? *
Form Border style
What is the code to add an item in listbox? *
Given: Listbox 1
Given: Apple
ListBox1.items.Add("Apple")
What is the code to clear item in a combo box? *
Given: Combobox1
Combobox1.ltems.clear