0% found this document useful (0 votes)
23 views7 pages

Visual Programming and Concepts Guide

The document provides an overview of visual programming, programming concepts, and the problem-solving process in computing. It covers structural and object-oriented programming, algorithms, and the use of Visual Basic for application development. Additionally, it discusses database management systems and includes examples of simple programming tasks and applications.

Uploaded by

jefiasjj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views7 pages

Visual Programming and Concepts Guide

The document provides an overview of visual programming, programming concepts, and the problem-solving process in computing. It covers structural and object-oriented programming, algorithms, and the use of Visual Basic for application development. Additionally, it discusses database management systems and includes examples of simple programming tasks and applications.

Uploaded by

jefiasjj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1) Visual Programming

a) Computer: A machine that manipulates data based on the instructions it receives.


i) General functions of a computer: data processing, control, design & development and data
communication.
ii) Elements required by a computer: They are input, process and output.
b) Programming language: is necessary because a computer needs a suitable programming language in the
process of developing programmes to solve certain problems.

2) Programming Concepts
a) Programming: The process of planning, tabling or the implementation of a task or event or command. In the
computing field, programming is instructing a computer to perform specific tasks as instructed.
b) Computer programming can be defined as the process of planning a set of sequence commands to be
executed by a computer.
c) Computer programs on the other hand can be defined as a set of sequence commands that have been
determined to be executed by a computer.
d) Manual problem solving involves the use of pen and paper or other means. Our approaches to planning and
problem solving may differ, but the input and output will be the same. Manual calculation becomes more
difficult if it involves many numbers.
e) Programming problems are problems that can be solved by using programming languages.
f) Problem Solving Process (Programming Process): There are two phases
i) Problem Understanding Phase:
(1) Analysis
 It is important to identify and understand the problem correctly.
 For example, if the problem is to add 10 numbers of different numeric values, then the
programmer must identify the types of input, the appropriate processing method and the
required output design.
(2) Algorithms
 It represents the program development
process.
 It traces any logical errors that exist.
 It uses pseudo code or flow charts.
(3) Testing
 Test the algorithms by entering a few
appropriate data.
 Trace each sequence processed.
 Ensure each sequence is in correct order.
ii) Implementation Phase:
(1) Program
 Code writing using the appropriate programming language.
 Program coded based on tested algorithms.
 All program syntax must be followed.
(2) Debugging
 Ensure the programs are fully functional.
 Various methods of testing procedures need to be taken, such as high volume of data input, out
of range input and other functions involved.
(3) Maintenance
 Final phase for programs to be updated and documented.
 Modifying the programs from time to time.
[Link]
Page 1
3) Planning for Problem Solving
a) Algorithms: present a finite sequence for problem solving.
i) Pseudo codes: Outlines of a program, written in a form that can easily be converted into real
programming statements.
 The benefit of pseudo codes is that
it enables the programmer to
concentrate on the algorithms
without worrying about all the
syntactic details of a particular
programming language.
ii) Flow charts: A graphical form of pseudo
codes, represented by geometrical
nodes connected by arrows to show the
flow or activity.

4) Structural & Object Oriented Programming


a) Structural programming: is a sequential program, instructions are processed one at a time. A program is
divided into functions and modules.
i) 'Divide and instruct' concept: The division of tasks to smaller subprograms
ii) Requires:
(1) Program development environment: Method of writing and implementing a structural program.
(2) Language: Instruction pertaining to the syntax and suitable algorithms.
(3) Library: Support functions that must be prepared to enable the implementation of a structural
program by a computer.
iii) Importance of Structural Programming
(1) It is the basic of learning about other programs.
(2) It is useful as a student’s first exposure to learning about programming.
(3) It is easily implemented to simpler programming problems.
(4) The concept can be applied to complex and big programming problems, but this involves a critical
and accurate planning and implementation process.
b) Object‐Oriented Programming: Combines both data and the functions that operate that data into one single
unit called an object.
i) Basic Components of Object‐Oriented Programming
(1) Object: An object is something that has condition, behaviour and identity.
(2) Relationship of object behaviour and state: Object behaviour and state are very closely related. The
current state of an object represents the cumulative results of the object’s behaviour. The object
state influences its behaviour.
(3) Object interface: Objects receive messages from servers that require a reaction. The list of
messages that are associated with an object is known as the object interface. In object orientation,
the object interface determines the interaction with that object.
ii) Class: Concept used to overcome the problem of too many objects involved in a program. Two parts:
(1) Attribute list that is contained in each object in a particular class.
(2) Behaviour list for each object from that particular class, which is how the object reacts to each
message that it understands
iii) Importance of Object‐Oriented Programming:
(1) Objects and classes can be reused without constructing new ones.
(2) Object‐oriented software is easier to operate and modify.
(3) The polymorphism is capable of performing two processes at one time.

[Link]
Page 2
5) Visual & Script
a) Visual: Refers to the representation of an object in graphical form.
b) Objects in visual programming are labels, text boxes, buttons etc.
c) Graphical Representation enables programs to be developed
effortlessly. The program also appears more interesting to the user.
d) Property: Something that can be changed. Eg. A button’s color etc.
e) Events: Actions that take place when the user does something to the
object. Eg. click(), doubleclick() etc

f) Visual Basic .NET: A programming language designed to create applications that work with Microsoft's .NET
Framework.
g) (dot).NET: An Object‐Oriented Programming platform.
h) [Link] is a development tool that you can use to build applications that perform useful work and look great
within a variety of settings. Using [Link], you can create applications for the Windows operating system,
the Web, hand‐held devices, and a host of other environments and settings.

i) Script : A programming concept that is different from both structural and object oriented programming.
i) Difference between Script and other Programming
(1) Script cannot be used without the support of client‐servers: Unlike normal programming
languages, script is dependant on Web servers for its implementation. When developing script,
testing is conducted in the Web browser that supports it.
(2) Script does not have its own space to build programs: HTML editors that are available in the
market, provide the space needed by programmers to place scripts in HTML tag codes.
ii) Script can be used for the following purposes:
(1) Choosing menu's provided in HTML documents.
(2) Detect errors.
(3) Enabling delivery of information forms.
(4) Downloading pictures.
(5) Mouse commands and functions.
iii) Scripts can be divided into two types, Server (sometimes using CGI), Client:
iv) Client‐Server Concept: The client’s computer will ask the server to perform a specific task. The server
will execute the task by generating useful information for the client. The server may also be a client of
other servers. Both the server and the client will perform their own processes. This process can be done
by the same computer or by separate computers.

6) Introduction to Visual Basic


a) Provides easy graphic interface.
b) Can control the implementation of applications using programs.
c) Capable of achieving API (Application Program Interface).
d) The convenience of object‐oriented programs.
e) Controls errors in writing.
f) Can implement structural programs.

7) Introduction to Visual Basic Components


8) Using Objects and Program Commands

[Link]
Page 3
9) Writing Simple Programs
a) Variable: A temporary storage location. It holds certain values for a certain period of time and the value can
be changed.
b) Variable Name: is the name that represents the variable but is dependent on the following conditions:
i) It cannot begin with numbers, example: 9num.
ii) It cannot have spaces between words, example: max value.
iii) It cannot contain hyphen marks, example: num‐max.
iv) Can contain underscore in the variable name, example: num_max.
v) The variable name can contain numbers, example: Value1_1.

10) Control, Array & String


11) Introduction to ActiveX

12) Database & Visual Basic


a) Database: A collection of data about related entities. Its application is to assist the process of collecting,
storing and accessing data effectively.
b) Entity: Items of objects, people, places or events where data and information are about the referred item.
c) Attribute/Field: Data that explains properties/characteristics of entities.
d) Record: Collection of several attributes that are related to an entity.

e) Table: A rectangular array of data. Each column of the table is called a field. Each row, called a record,
contains the same type of information as every other row.

f) Database Management System (DBMS): A system that exists specifically to manage the database. DBMS
makes sure that the data entered into the database can be viewed, manipulated, opened and accessed
easily.
i) Advantages:
 Data is easily viewed by user;
 Easy to access; and
 Easily manipulated by the user to generate information using SQL instructions.

g) Relational DBMS. This type of DBMS separates data into categories that are named entities. An entity has
attributes which is data that comprise of data name and value (attribute name and value).

h) [Link]: A collection of classes, interfaces, structures, and enumerated types that manage data access
from relational data stores within the .NET Framework. Its Objects:
i) Connection Object: Represent a connection to the database.
ii) Command Object: The command object allows us to execute a SQL statement or a stored procedure.
iii) DataReader: It is a read‐only and forward‐only pointer into a table to retrieve records.
iv) DataSet Object: A DataSetobject can hold several tables and relationships between tables.
v) DataAdapter: This the object used to pass data between the database and the dataset.

13) Developing Applications

[Link]
Page 4
14) Codes

a) Figure below show an interface for a weather application. it displays a common word to describe the
temperature base on actual temperature rangers. the temperature ranges and words to describe the
ranges are as follows. at least 90 and up to 130 is sweating, at least 70 and below 90 is warm, at least 50
and below 70 is cool, at least 32 and and below 50 is cold, below 32 up to ‐70 is freezing. Build an
application as the instruction mentioned.

Public Class Form1


Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles
[Link]
Dim i As Integer = Val([Link])
Dim ss As String
Select Case i
Case 90 To 130
ss = "SWEATING"
Case 70 To 89
ss = "WARM"
Case 50 To 69
ss = "COOL"
Case 32 To 49
ss = "COLD"
Case ‐70 To 31
ss = "FREEZING"
Case Else
ss = "INVALID"
End Select
[Link] = ss
End Sub

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As [Link]) Handles


[Link]
[Link]()
[Link]()
[Link]()
End Sub
End Class

a) One fast food company runs a business with selling pizza (for $3.25). Write a program to count one
customers bill. This program must input the quantity of each order. Sample Output is given below.

'Author: Mohamed
Public Class Form1
'Initialising constant variables
Const pizza As Double = 3.25
Const potatoes As Double = 2.0
Const drink As Double = 1.75

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles


[Link]
'Displaying the Output bill information in a text box
[Link] = "Item" & vbTab & vbTab & "Quantity" & vbTab & vbTab & "Price" & vbNewLine
[Link]("Pizza" & vbTab & vbTab & Val([Link]) & vbTab & vbTab &
[Link]("${0:#.00}", Val([Link]) * pizza) & vbNewLine)
[Link]("potatoes" & vbTab & vbTab & Val([Link]) & vbTab & vbTab &
[Link]("${0:#.00}", Val([Link]) * potatoes) & vbNewLine)
[Link]("drink" & vbTab & vbTab & Val([Link]) & vbTab & vbTab &
[Link]("${0:#.00}", Val([Link]) * drink) & vbNewLine)
[Link](vbNewLine)
[Link]("Total need to pay" & vbTab & vbTab & vbTab &
[Link]("${0:#.00}", Val([Link]) * pizza + Val([Link]) * potatoes +
Val([Link]) * drink))

End Sub
End Class

[Link]
Page 5
b) Develop an MDI application which allows the user to enter a password that contains five, six , or seven
characters. The application should create and display a new password as follows:
i) Replace all vowels (A, E, I, O and U) with the letter x.
ii) Replace all numbers with the letter z.
iii) Reverse the characters in the password
'Codes for MDI Parent Form1
Public Class Form1
Private Sub OpenToolStripMenuItem_Click(ByVal sender As
[Link], ByVal e As [Link]) Handles
[Link]
[Link] = Me
[Link]()
End Sub
End Class

'Codes for MDI Child Form2


Public Class Form2
Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles
[Link]
If [Link] < 5 Or [Link] > 7 Then
[Link] = "ENTER 5 TO 7 CHARACTERS!"
Else
[Link] = generate([Link])
End If
End Sub

'Function to make the conversions, value entered passed to 'pass' String variable
Private Function generate(ByVal pass As String)
' Replace all vowels (A, E, I, O and U) with the letter x.
pass = [Link]("A", "X")
pass = [Link]("E", "X")
pass = [Link]("I", "X")
pass = [Link]("O", "X")
pass = [Link]("U", "X")

pass = [Link]("a", "X")


pass = [Link]("e", "X")
pass = [Link]("i", "X")
pass = [Link]("o", "X")
pass = [Link]("u", "X")

'Replace all numbers with the letter z.


pass = [Link]("1", "Z")
pass = [Link]("2", "Z")
pass = [Link]("3", "Z")
pass = [Link]("4", "Z")
pass = [Link]("5", "Z")
pass = [Link]("6", "Z")
pass = [Link]("7", "Z")
pass = [Link]("8", "Z")
pass = [Link]("9", "Z")
pass = [Link]("0", "Z")

'Reverse the characters in the password


Dim pass2() As Char = [Link]
[Link](pass2)

'Return the generated new password


Return pass2

End Function

End Class

[Link]
Page 6
c) Creating a Simple Database Manipulation Application with CRUD (Create, Read
Update, Delete)

Imports [Link]

Public Class Form1

Dim conn As New OleDbConnection("Provider=[Link].12.0;Data Source=C:\[Link]")


Dim rd As OleDbDataReader
'SQL Commands
Dim cmdCreate As New OleDbCommand("insert into table1 values (10, 'Abdulla Farish',
'Janitorial')", conn)
Dim cmdRead As New OleDbCommand("select * from table1 where EmpNo = 10", conn)
Dim cmdUpdate As New OleDbCommand("update table1 set Ename = 'Mohamed Hassan', Department =
'Programming' where EmpNo = 10", conn)
Dim cmdDelete As New OleDbCommand("delete from table1 where EmpNo = 10", conn)

'Create Record
Private Sub btnCreate_Click(ByVal sender As [Link], ByVal e As [Link]) Handles
[Link]
[Link]()
rd = [Link]
[Link]("Created", "RECORD CREATED")
[Link]()
[Link]()
End Sub

'Read Record
Private Sub btnRead_Click(ByVal sender As [Link], ByVal e As [Link]) Handles
[Link]
[Link]()
rd = [Link]
If ([Link]()) Then
[Link]("ID: " & rd(0) & ", Name: " & rd(1) & ",
Department: " & rd(2), "RECORD READ")
End If
[Link]()
[Link]()
End Sub

'Update Record
Private Sub btnUpdate_Click(ByVal sender As [Link], ByVal e As [Link]) Handles
[Link]
[Link]()
rd = [Link]
[Link]("Updated", "RECORD UPDATED")
[Link]()
[Link]()
End Sub

'Delete Record
Private Sub btnDelete_Click(ByVal sender As [Link], ByVal e As [Link]) Handles
[Link]
[Link]()
rd = [Link]
[Link]("Deleted", "RECORD DELETED")
[Link]()
[Link]()
End Sub
End Class

[Link]
Page 7

You might also like