0% found this document useful (0 votes)
31 views

Computer 2nd QA Reviewer

The document discusses IDEs and the Visual Studio IDE. It describes the main components of the Visual Basic window in Visual Studio like the title bar, menu bar, toolbar, toolbox, solution explorer, properties window, designer window, and code editor. It also discusses variables, naming conventions, decision structures like If/Then and loops, procedures, and input/output functions in Visual Basic.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Computer 2nd QA Reviewer

The document discusses IDEs and the Visual Studio IDE. It describes the main components of the Visual Basic window in Visual Studio like the title bar, menu bar, toolbar, toolbox, solution explorer, properties window, designer window, and code editor. It also discusses variables, naming conventions, decision structures like If/Then and loops, procedures, and input/output functions in Visual Basic.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

GETTING TO KNOW THE IDE

IDE a.k.a Integrated Development Environment


a programming environment which supports a set of programming languages in creating
applications. The main IDE for languages like VB.NET, C#, ASP.NET, and C++ is Visual Studio
which was created by Microsoft specifically for its .NET platform.

The Visual Basic Window


1. Title Bar – located at the topmost of the window containing the project’s name
2. Menu Bar – contains the commands that are used when creating the application. Always
visible
3. Toolbar – provides the user quick access to the most commonly used functions of the
program
4. Toolbox – commonly a library of controls which a programmer uses in creating an
application
5. Solution Explorer Window – contains the list of all forms, modules and classes
associated with the current project
6. Properties Window – represents the properties of selected objects or controls in a
project
7. Designer or Form Window – primary work area where the visual development of the
application is created or modified
8. Code View or Code Editor – serves as an editor for entering application code to be
executed
9. Data Source – displays the date source in the project. Data sources represent the data
available for the application such as the database and database function.
10. Form Layout Window – a visual design tool. Users can control the placement of forms
in a windows environment when executed.

DATA MANAGEMENT
Variables
the areas allocated by the computer memory to hold the data

Rules to follow in naming a variable:


 Must be less than 255 characters
 No spacing is permitted
 Must not begin with a number or any other character other than the letters of the
alphabet and underscore (_)
 Period is not allowed
 Don’t use reserved keyword
 It can’t have the same name as any other variable
Different Naming Conventions
Hungarian Notation: aims coders to remember the type of variable used and is the most
commonly used convention in Visual Basic.
Uses the first three letters of the data type as the prefix of the variable’s name to distinguish
the sub type. The fourth letter of the variable is typed in uppercase to indicate that this is
where the actual variable name starts

DATA TYPE PREFIXES EXAMPLE


boolean blnMember Dim blnMember As Boolean
char chrChar Dim chrChar As Char
date datToday Dim datToday As Date
Integer intSalary Dim intSalary As Integer

Camel Case Notation: easier and quicker to type than other notations and is the practice
of writing compound words or phrases in which words are joined without spaces and are
capitalized within the compound, thus, looking like humps of a camel.

It’s the general term for using lowercase letters except for the starting letter of a syllable
myName
totalAmount
manufacturedDate

DECISION AND LOOP STRUCTURE


Decision Structures – program elements that control the flow of the application based on
the decisions made by the programmer about the value of variables or events. Allow the
program to decide and change its behavior based on that decision.
If Then Structure (The simplest and most important statement in a program)
a control structure which executes a set of code only when the given condition is True
Syntax:
If condition Then
Executable statements when the condition is True
End If
If Then Else Structure
conditionally executes a group of statements, depending on the value of an expression
Syntax:
If condition Then
Executable statements when the condition is True
Else
Executable statements when the condition is False
End If
If Then Else If Structure (an If statement followed by an optional Else If statement, which is
very useful in testing various conditions using single If Else If statement)
Provides two or more conditions inside the program

Syntax:
If condition Then
Executable statement
ElseIf
Executable statement
Else
Executable statement
End If

PROCEDURES IN VISUAL BASIC


Calling a Procedure
Sub procedures don’t return a value but return control to the calling code after performing the
task

Calling code – a statement or an expression within a statement that specifies the procedure by
name and transfers the control to it
When naming a Procedure,
- it must begin with a letter
- shouldn’t have periods, mathematical, or comparison operators
- should be unique and not have a same name
Example:
Sub Assign ()
Dim strFullName As String
srtFullName = “Paul Cruz”
MessageBox.Show (strFullName)
End Sub
Public Sub Main ()
Call Assign ()
End Sub

Mathematical Functions
very useful and important in programming especially when dealing with mathematical concepts
in programming.
o Abs function returns the absolute value of a given number
Syntax: Math.Abs(Number)
o Exp function returns the exponential value of a given number
Syntax: Math.Exp(Number)
o Log function returns the natural logarithm of a number
Syntax: Math.Log(Number)
o Fix shortens the decimal part of a positive number and returns the largest integer smaller
than the number, but when the number’s negative, it returns the smallest integer larger than
the number
Syntax: Fix(number)
o Rnd function is used to write code that involves chance and probability, and returns a
random value between 0 and 1
Syntax: VBMath.Rnd()*Number
o Round function rounds up a number to a certain number of decimal place
Syntax: Math.Round(number, m)
o Sqrt returns the square root of a number
Syntax: Math.Sqrt(Number)

Date Functions
reads the system clock and returns the current date as a string in the format MM/DD/YY
1. Now# function returns a date value containing the current date and time according to the
system setting.
Syntax: [variable | control] = Now ()
2. Today# function returns a date value containing current date only
Syntax: [variable | control] = Today ()
3. TimeOfDay# function returns the date value containing current time only
Syntax: [variable | control] = TimeOfDay ()
Input and Output Functions
allows the system to handle input from the user and output that is resulted from the code
 InputBox function displays a message box, where user can input data
Variable = InputBox (Prompt, Title, default_text, x-position, y-position)
o Prompt: message displayed prompting what is to be entered
o Title: the title of the input box
o Default-text: the default text that appears inside the input box
o X-position and Y-position: the position of the coordinates of the input box

Example:
Dim anum As String
Anum = InputBox (“What is your name?”, “Type here”, name, 500, 500)
 MsgBox function produces a pop-up message box and prompts the user to click on a
command button before going to the next instruction
Variable = MsgBox (Prompt, Style Value, Title)
o Prompt: Message displayed in the message box
o Style Value: These are command buttons that will appear on the message box
o Title: The title of the message box

Style Value Name of Constant Displayed Buttons


0 vbOkOnly Ok button
1 vbOkCancel Ok and Cancel buttons
2 vbAbortRetryIgnore Abort, Retry, and Ignore
buttons
3 vbNoCancel Yes, No, and Cancel buttons
4 vbYesNo Yes and No buttons
5 vbRetryCancel Retry and Cancel buttons

You might also like