The document contains source code and instructions for programming exercises in Visual Basic (VB). It includes 14 exercises ranging from basic programs like printing sentences to more complex programs like an online examination system with a timer and calculator. The exercises cover topics like string manipulation, conditional statements, controls and forms in VB. The document provides the algorithm, source code, and expected output for each programming exercise to help learn VB programming concepts.
This document provides examples of various Visual Basic applications using different controls. It includes 12 short applications demonstrating:
1. Label and text box controls to display input fields.
2. A calculator application using command buttons to perform arithmetic operations on two input numbers.
3. Radio buttons to display options and respond to user selection.
4. A form with text boxes, combo boxes and command buttons to accept user input.
5. A timer control changing the visibility of shapes to simulate traffic lights.
6. Getting user input on a form and displaying marks on another frame.
So in summary, it presents 12 mini-projects to demonstrate common Visual Basic controls and concepts like forms, buttons
The document contains 9 VB.Net programs with code examples and output. The programs cover topics like counting vowels in a string, checking if a number is even/odd/overflow, calculating compound interest, summing positive and negative numbers from user input, concatenating strings with message box, changing font style based on checkboxes, generating a student enrollment form with combo boxes, creating a dynamic user login form using a database, and implementing a multiple document interface with parent and child forms.
PT1420: File Access and Visual Basic
Page 1
This lab examines how to work with a file by writing Visual Basic code. Read the following
programming problem prior to completing the lab.
Write and design a simple program that will take 3 pieces of data and write it to a file. Create
variables and set them equal to the appropriate values:
Declare string firstName = “xxx”
Declare string lastName = “xxx”
Declare integer age = your age
Write this information to a file called myRecords.txt. Next, read this information from
the file and print it to the screen.
Step 1: Create a new Visual Basic workspace and add the following code:
Module Module1
Sub Main()
Dim firstName As String = "XXXX"
Dim lastName As String = "XXX"
Dim age As Integer = ####
Dim writer As System.IO.StreamWriter = System.IO.File.CreateText("myRecords.txt")
writer.WriteLine(firstName & " " & lastName & " " & age)
writer.Close()
Dim reader As System.IO.StreamReader = System.IO.File.OpenText("myRecords.txt")
Dim myInfo As String = reader.ReadLine()
Console.WriteLine(myInfo)
PT1420: File Access and Visual Basic
Page 2
reader.Close()
'this causes a pause so you can see your program
Console.Write("Press enter to continue...")
Console.ReadLine()
End Sub
End Module
Your module looks like this:
PT1420: File Access and Visual Basic
Page 3
Step 2: Change the values of the variables to your records. Your module looks like this:
Step 3: Run your program so that it works properly. Your output might look as follows:
PT1420: File Access and Visual Basic
Page 4
Step 4: Locate the .txt file in the bin\debug folder, and view your .txt file. Your output might
look as follows:
PT1420: File Access and Visual Basic
Page 5
Step 5: Submit the Visual Basic code as a compressed (zipped) folder using the following steps:
a. Open Windows Explorer --> Start --> All Programs --> Accessories --> Windows Explorer.
Your Windows Explorer might look as follows:
...
The document discusses various looping constructs and array concepts in VB.NET. It covers while, do, for, for each loops and nested loops. It explains arrays, multidimensional arrays, and array functions. It also discusses procedures, functions, and passing arguments by value and reference. Key looping constructs include while-end while, do-loop, for-next, and for each-next loops. Arrays allow storing multiple variables of the same type under one name. Functions and procedures are blocks of reusable code that can optionally return values. Arguments can be passed by value, where the called code cannot modify the original variable, or by reference, where the called code can modify the original variable.
This document provides instructions and code examples for 8 lab exercises involving Visual Basic programming. Exercise 1 demonstrates using text boxes and command buttons. Exercise 2 loads multiple forms. Exercise 3 creates a timer program. Exercise 4 demonstrates command buttons and text manipulation. Exercise 5 involves list boxes and combo boxes. Exercise 6 builds a basic calculator application using arrays. Exercise 7 demonstrates string operations and conversions using a custom class. Exercise 8 uses picture boxes and labels to demonstrate color values.
import java.util.Scanner;Henry Cutler ID 1234 7202.docxwilcockiris
import java.util.Scanner;
/*
Henry Cutler ID 1234 7/20/2015
Assignment #5, 3 features in 1 program
Solution
for Assignment#5 COP2800
Pseudocode:
Program has three features, all in a single program that are user selectable.
Prompt with options and get user choice inside a while statement ( true )
If 1 is entered:
Using a while and for loop, print out the ASCII table from ! to ~.
If 2 is entered:
Prompt the user for number of times to flip for head or tails using the random method. Count number of each and when the request times are done, print out the results.
If 3 is entered:
Prompt the user for a strings and print back the count of vowels and letters
Any other input entered program will exit using a break statement, otherwise loops back to prompt user for feature selection.
*/
public class Module5 {
public static void main(String[] args) {
// prompt the user
System.out.println("Welcome to Henry\'s 3 in 1 Programming Assignment for Module 5\n");
// create Scanner Object
Scanner input = new Scanner(System.in);
// loop until break
while(true){
// new lines for readability
System.out.print("\n");
// Prompt user for choices
System.out.print("Enter 1 for ASCII Table \nEnter 2 for Heads or Tails\nEnter 3 for Count Vowels & Letters\nAny other input will exit");
int choice = input.nextInt();
// Consume newline left-over
input.nextLine();
// first feature
if(choice == 1){
// start value is !
int value = (int) '!';
// newline for formating
System.out.println("You Selected ASCII Table!\n");
// start at ~ which is 33 decimal
while( value <= '~')
{
// print out 20 in a line
for( int count = 0; count < 20; count ++ ){
if( value <= '~'){
// print single value
System.out.print( (char) value++ );
}
else {
// break when we are at last char to print
break;
}
}
// New line every 10
System.out.print("\n");
}
// New line at exit
System.out.print("\n");
}
else if(choice == 2){
// Prompt user
System.out.println("You Selected Head or Tails!");
System.out.println("\nHow many flips would you like to try?");
// get value
int count = input.nextInt();
// clear
input.nextLine();
int headCount = 0;
int tailCount = 0;
// run for a count provided by user
for (int i = 0; i < count; i++) {
// get random number
if (Math.random() > 0.5){
// increment heads
headCount++;
}
else {
// increment tails
tailCount++;
}
}
System.out.println("Head count: " + headCount + " tail count: " + tailCount);
}
else if(choice == 3){
// Prompt user
Sys.
This document contains instructions and code for several programming assignments. It includes:
1. An email address checker program that parses a student email and displays the name and school.
2. A dice simulation program that rolls a dice multiple times and counts the frequency of each result.
3. Code for classes in an inheritance hierarchy including Person, Employee, Customer, PartTime, and FullTime with methods to input and display object details.
4. Methods to compare Employee and FullTime objects and a test program to demonstrate.
5. An abstract Account class and subclasses Current and Savings with methods to input and display account details.
So in summary, it provides full programming assignments on parsing emails,
PT1420 Decision Structures in Pseudocode and Visual Basic .docxamrit47
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 1
This lab requires you to think about the steps that take place in a program by writing
pseudocode. Read the following program prior to completing the lab.
Career Tech Placement is hiring employees for placement at technology firms across the
city. Prior to granting an interview, the company has a 100-point test that is used to
determine if the candidate should be interviewed. Depending on the candidate’s score,
he or she will be placed in 1 of 4 categories for possible employment and flagging for an
interview:
Score Employment Category Interview Possibility
85 or above Definite Yes
70 – 84 Likely Yes
60 – 69 Maybe Yes
59 or below No No
Career Tech Placement has asked you to write a program that will allow the company to
enter a test score and then set the employment category and the interview possibility
variables based on the chart above.
Given the major task involved in this program, you decide your program should have three
variables and three modules:
Variable Name Purpose
Declare Integer testScore = 0 Stores the test score of the candidate.
Declare String category = “ “ Stores Definite, Likely, Maybe, or No
Declare String interview = “ “ Stores Yes or No
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 2
Module Name Purpose
Module getScore() Allows the user to enter the test score
Module employCat() Determines the employment category
Module interviewPoss() This module will determine if a day off should
be awarded.
Module displayInfo() Displays the testScore, category, and interview
variables.
Step 1: Complete the pseudocode by writing the missing lines. When writing your modules and
making calls, be sure to pass necessary variables as arguments and accept them as reference
parameters if they need to be modified in the module (Reference: Testing a Series of
Conditions, page 138 from your textbook, Starting Out with Programming Logic & Design.).
Main Module()
//Declare variables on the next 3 lines
//Make Module calls and pass necessary variables on the next 4 lines
End Main
Module getScore(Integer Ref testScore)
//Ask the user to enter a test score
End Module
Module employCat(Integer testScore, String Ref category)
//Determine what employment category they are in based on their test score
//Similar to if the score is less than 60, then category is “No”
PT1420: Decision Structures in Pseudocode and Visual Basic
...
This document provides examples of various Visual Basic applications using different controls. It includes 12 short applications demonstrating:
1. Label and text box controls to display input fields.
2. A calculator application using command buttons to perform arithmetic operations on two input numbers.
3. Radio buttons to display options and respond to user selection.
4. A form with text boxes, combo boxes and command buttons to accept user input.
5. A timer control changing the visibility of shapes to simulate traffic lights.
6. Getting user input on a form and displaying marks on another frame.
So in summary, it presents 12 mini-projects to demonstrate common Visual Basic controls and concepts like forms, buttons
The document contains 9 VB.Net programs with code examples and output. The programs cover topics like counting vowels in a string, checking if a number is even/odd/overflow, calculating compound interest, summing positive and negative numbers from user input, concatenating strings with message box, changing font style based on checkboxes, generating a student enrollment form with combo boxes, creating a dynamic user login form using a database, and implementing a multiple document interface with parent and child forms.
PT1420: File Access and Visual Basic
Page 1
This lab examines how to work with a file by writing Visual Basic code. Read the following
programming problem prior to completing the lab.
Write and design a simple program that will take 3 pieces of data and write it to a file. Create
variables and set them equal to the appropriate values:
Declare string firstName = “xxx”
Declare string lastName = “xxx”
Declare integer age = your age
Write this information to a file called myRecords.txt. Next, read this information from
the file and print it to the screen.
Step 1: Create a new Visual Basic workspace and add the following code:
Module Module1
Sub Main()
Dim firstName As String = "XXXX"
Dim lastName As String = "XXX"
Dim age As Integer = ####
Dim writer As System.IO.StreamWriter = System.IO.File.CreateText("myRecords.txt")
writer.WriteLine(firstName & " " & lastName & " " & age)
writer.Close()
Dim reader As System.IO.StreamReader = System.IO.File.OpenText("myRecords.txt")
Dim myInfo As String = reader.ReadLine()
Console.WriteLine(myInfo)
PT1420: File Access and Visual Basic
Page 2
reader.Close()
'this causes a pause so you can see your program
Console.Write("Press enter to continue...")
Console.ReadLine()
End Sub
End Module
Your module looks like this:
PT1420: File Access and Visual Basic
Page 3
Step 2: Change the values of the variables to your records. Your module looks like this:
Step 3: Run your program so that it works properly. Your output might look as follows:
PT1420: File Access and Visual Basic
Page 4
Step 4: Locate the .txt file in the bin\debug folder, and view your .txt file. Your output might
look as follows:
PT1420: File Access and Visual Basic
Page 5
Step 5: Submit the Visual Basic code as a compressed (zipped) folder using the following steps:
a. Open Windows Explorer --> Start --> All Programs --> Accessories --> Windows Explorer.
Your Windows Explorer might look as follows:
...
The document discusses various looping constructs and array concepts in VB.NET. It covers while, do, for, for each loops and nested loops. It explains arrays, multidimensional arrays, and array functions. It also discusses procedures, functions, and passing arguments by value and reference. Key looping constructs include while-end while, do-loop, for-next, and for each-next loops. Arrays allow storing multiple variables of the same type under one name. Functions and procedures are blocks of reusable code that can optionally return values. Arguments can be passed by value, where the called code cannot modify the original variable, or by reference, where the called code can modify the original variable.
This document provides instructions and code examples for 8 lab exercises involving Visual Basic programming. Exercise 1 demonstrates using text boxes and command buttons. Exercise 2 loads multiple forms. Exercise 3 creates a timer program. Exercise 4 demonstrates command buttons and text manipulation. Exercise 5 involves list boxes and combo boxes. Exercise 6 builds a basic calculator application using arrays. Exercise 7 demonstrates string operations and conversions using a custom class. Exercise 8 uses picture boxes and labels to demonstrate color values.
import java.util.Scanner;Henry Cutler ID 1234 7202.docxwilcockiris
import java.util.Scanner;
/*
Henry Cutler ID 1234 7/20/2015
Assignment #5, 3 features in 1 program
Solution
for Assignment#5 COP2800
Pseudocode:
Program has three features, all in a single program that are user selectable.
Prompt with options and get user choice inside a while statement ( true )
If 1 is entered:
Using a while and for loop, print out the ASCII table from ! to ~.
If 2 is entered:
Prompt the user for number of times to flip for head or tails using the random method. Count number of each and when the request times are done, print out the results.
If 3 is entered:
Prompt the user for a strings and print back the count of vowels and letters
Any other input entered program will exit using a break statement, otherwise loops back to prompt user for feature selection.
*/
public class Module5 {
public static void main(String[] args) {
// prompt the user
System.out.println("Welcome to Henry\'s 3 in 1 Programming Assignment for Module 5\n");
// create Scanner Object
Scanner input = new Scanner(System.in);
// loop until break
while(true){
// new lines for readability
System.out.print("\n");
// Prompt user for choices
System.out.print("Enter 1 for ASCII Table \nEnter 2 for Heads or Tails\nEnter 3 for Count Vowels & Letters\nAny other input will exit");
int choice = input.nextInt();
// Consume newline left-over
input.nextLine();
// first feature
if(choice == 1){
// start value is !
int value = (int) '!';
// newline for formating
System.out.println("You Selected ASCII Table!\n");
// start at ~ which is 33 decimal
while( value <= '~')
{
// print out 20 in a line
for( int count = 0; count < 20; count ++ ){
if( value <= '~'){
// print single value
System.out.print( (char) value++ );
}
else {
// break when we are at last char to print
break;
}
}
// New line every 10
System.out.print("\n");
}
// New line at exit
System.out.print("\n");
}
else if(choice == 2){
// Prompt user
System.out.println("You Selected Head or Tails!");
System.out.println("\nHow many flips would you like to try?");
// get value
int count = input.nextInt();
// clear
input.nextLine();
int headCount = 0;
int tailCount = 0;
// run for a count provided by user
for (int i = 0; i < count; i++) {
// get random number
if (Math.random() > 0.5){
// increment heads
headCount++;
}
else {
// increment tails
tailCount++;
}
}
System.out.println("Head count: " + headCount + " tail count: " + tailCount);
}
else if(choice == 3){
// Prompt user
Sys.
This document contains instructions and code for several programming assignments. It includes:
1. An email address checker program that parses a student email and displays the name and school.
2. A dice simulation program that rolls a dice multiple times and counts the frequency of each result.
3. Code for classes in an inheritance hierarchy including Person, Employee, Customer, PartTime, and FullTime with methods to input and display object details.
4. Methods to compare Employee and FullTime objects and a test program to demonstrate.
5. An abstract Account class and subclasses Current and Savings with methods to input and display account details.
So in summary, it provides full programming assignments on parsing emails,
PT1420 Decision Structures in Pseudocode and Visual Basic .docxamrit47
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 1
This lab requires you to think about the steps that take place in a program by writing
pseudocode. Read the following program prior to completing the lab.
Career Tech Placement is hiring employees for placement at technology firms across the
city. Prior to granting an interview, the company has a 100-point test that is used to
determine if the candidate should be interviewed. Depending on the candidate’s score,
he or she will be placed in 1 of 4 categories for possible employment and flagging for an
interview:
Score Employment Category Interview Possibility
85 or above Definite Yes
70 – 84 Likely Yes
60 – 69 Maybe Yes
59 or below No No
Career Tech Placement has asked you to write a program that will allow the company to
enter a test score and then set the employment category and the interview possibility
variables based on the chart above.
Given the major task involved in this program, you decide your program should have three
variables and three modules:
Variable Name Purpose
Declare Integer testScore = 0 Stores the test score of the candidate.
Declare String category = “ “ Stores Definite, Likely, Maybe, or No
Declare String interview = “ “ Stores Yes or No
PT1420: Decision Structures in Pseudocode and Visual Basic
Page 2
Module Name Purpose
Module getScore() Allows the user to enter the test score
Module employCat() Determines the employment category
Module interviewPoss() This module will determine if a day off should
be awarded.
Module displayInfo() Displays the testScore, category, and interview
variables.
Step 1: Complete the pseudocode by writing the missing lines. When writing your modules and
making calls, be sure to pass necessary variables as arguments and accept them as reference
parameters if they need to be modified in the module (Reference: Testing a Series of
Conditions, page 138 from your textbook, Starting Out with Programming Logic & Design.).
Main Module()
//Declare variables on the next 3 lines
//Make Module calls and pass necessary variables on the next 4 lines
End Main
Module getScore(Integer Ref testScore)
//Ask the user to enter a test score
End Module
Module employCat(Integer testScore, String Ref category)
//Determine what employment category they are in based on their test score
//Similar to if the score is less than 60, then category is “No”
PT1420: Decision Structures in Pseudocode and Visual Basic
...
The document provides an overview of Visual Basic 6 and its key concepts. It discusses Visual Basic as an event-driven programming language used to build graphical user interfaces. It explains some of Visual Basic's main features like data access, ActiveX technologies, and internet capabilities. It also covers important Visual Basic concepts like windows, events, event-driven programming, interpreting and compiling code, and the Visual Basic integrated development environment.
Bottom of FormCreate your own FunctionFunctionsFor eac.docxAASTHA76
Bottom of Form
Create your own Function
Functions
For each discussion, provide a snipplet of pseudo-code for the Main using an example call to the Function as well as the pseudo-code for the Function.
For each discussion, do the problem you are assigned to as described by the letters below.
Discussion 1 - Using Pseudocode, create a Function that accepts one or more input Integer numbers and returns a float number. You should name your function appropriately as to what it does. Be sure to document your Function with header and in-line comments.
Provide a snipplet of psuedo-code for the Main using an example call to the Function.
Make sure the variable names in the Main are different that in the Function. In the Main, provide the prompts and get the user responses. Then pass the data into the Function. After the call to the Function include a print statements that indicates the returning value from the call to the Function.
Put Discussion 1 - problem no.X in the Subject area.
You are assigned the problem no. below as follows: If your Last Name begins with:
A-B - do no. 1
C-F - do no. 2
G-H - do no. 3
I-K - do no. 4
L - do no. 5
M-P - do no. 6
Q-T - do no. 7
U-Z - do no. 8
1)Calculate the Area of a circle. Input: one number
2)Calculate the Circumference a circle. Input: one number
3)Convert the temperature from Celcius to Farenheit Input: one number
4)Convert the temperature from Farenheit to Celcius. Input: one number
5)Calculate 6 times a number squared. Input: one number
6)Calculate 3 times the (sum of three numbers). Input: three numbers
7)Calculate the average of four numbers. Input: four numbers
8)Calculate 5 times the (difference of two numbers). Input two numbers
You may do additional problems, if you want.
Discussion 2:
Convert Discussion 1 to C-code. Don't for get to prototype your function before the main and to define your function after the main. Put Discussion 2 - problem no.X in the Subject area and submit a .txt (or .c) file for your code.
CMIS 102 Hands-On Lab
Week 6
Overview:
This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, Analysis, Design(program design, pseudocode), Test Plan, and implementation with C code. The example provided uses sequential, repetition, selection statements and two user-defined function.
Program Description:
This program will provide options for a user to calculate the square or cube of a positive Integer input by a user. The program will prompt the user to enter an Integer and then prompt the user if they want to calculate the square of the cube of the number. Based on the inputs of the user, the program will output the square of the cube of the positive integer. The program will then print the Integer and square or cube of the integer based on the user’s original choice. The program will continue to prompt the user for
Integers and their calculation choice until the user enters a negative int ...
This document provides instructions for a lab assignment involving arrays and strings. There are two programs to be completed:
1) A video game player program that stores player names and scores in arrays, calculates the average score, and identifies players below average.
2) A Pig Latin translator that takes a phrase as input, separates it into words stored in a string array, and converts each word to Pig Latin by moving initial consonants to the end and adding "ay".
Students are directed to use pseudocode, write and compile the C++ code, and include a screen shot and their code in a Word document for submission.
This document provides an overview of WinForms GUI programming in .NET. It discusses how event-driven programming works in WinForms applications and how Visual Studio supports drag-and-drop design of WinForms. It also describes some key concepts like forms, controls, properties and events. The document explains how to set up a basic WinForms application and interact with common controls like labels, text boxes and buttons.
The document discusses various VB.NET concepts including modules, classes, variables, data types, and operators. It provides code examples to demonstrate working with console and windows form applications in VB.NET, declaring variables with different access specifiers, and using arithmetic, concatenation, comparison, and logical operators.
The document provides instructions for running Python code in both interactive and script modes. It explains that in interactive mode, code is executed immediately after being typed, while scripts run entire files of code. Steps are given to start an interactive session in the terminal or IDLE and run script files with Python filename.py. Code examples are also provided to demonstrate basic Python operations in the interactive interpreter like arithmetic, variables, functions, strings and control flow.
The document describes an iLab assignment to modify an Employee class to demonstrate composition and interfaces. Key points:
- Create a Benefits class to hold an employee's benefits like health insurance, life insurance, and vacation.
- Integrate the Benefits class into the Employee class using composition.
- Create an abstract iEmployee interface to guarantee the Employee class implements the calculatePay method.
- The goal is to enhance the existing Employee class from previous labs by adding benefits through composition and using interfaces.
Chapter 1 Class 12 Computer Science Unit 1ssusera7a08a
The document discusses the basics of Python programming language. It provides an introduction to Python, describing how it is an interpreted, high-level and general-purpose programming language. It then covers Python features, data types, operators, and how to work in both interactive and script modes in Python. The document also discusses topics like variables, data handling, arithmetic operators, comparison operators, and more with examples.
The document discusses Python programming language. It provides an introduction to Python, describing it as an interpreted, high-level and general-purpose programming language. It then covers various data types in Python including numbers, strings, booleans, lists, tuples, sets and dictionaries. The document also discusses operators in Python like arithmetic, comparison, logical and bitwise operators. Finally, it explains how to work with Python in both interactive and script modes.
Devry cis 170 c i lab 5 of 7 arrays and stringsjody zoll
This document provides instructions for a lab assignment with two programs - one that analyzes test scores from multiple players and finds those below average, and another that converts words to "pig latin". It includes requirements, pseudocode, steps to create and run the programs in Visual Studio, and instructions to capture output screenshots and code in a Word document for submission.
Software engineering modeling lab lectures
engineering+ education purpose
This series of lectures was prepared for the third class of software engineering / Aliraqia University/ Baghdad/ Iraq.
In prepared these lectures, I depend on the YouTube to make it, the programs of the lectures are designed and executed by vb.net, discussions are also found here
These lectures are not finished yet, i will improve it in the future
Forgive me for anything wrong by mistake, I wish you can profit from these lectures
My regard
Marwa Moutaz/ M.Sc. studies of Communication Engineering / University of Technology/ Bagdad / Iraq.
The document discusses different types of loops in C++ including while, do-while, for, and switch-case statements. It provides examples of using each loop or statement to repeat operations a certain number of times or while a condition is met. Key examples include a countdown loop using while, calculating factorials with for, and a calculator program using switch-case to perform math operations.
This document provides an overview of Visual Basic 6.0 and how to create a basic application. It outlines the objectives of learning Visual Basic and describes key concepts like the event-driven nature of VB applications. The document explains the structure of a VB project, including forms, controls, properties, methods and events. It also demonstrates how to set control properties, write code, declare variables, and use common functions and operators. Finally, it provides examples for creating a stopwatch timer application and a basic text editor application in VB.
This document provides instructions for creating a basic antivirus program using Visual Basic 2010 in 3 steps:
1. Install Visual Basic 2010 and create a new project
2. Design the user interface with buttons, lists, tracks, and media players
3. Add code to each component to assign functions like opening files, playing audio, adjusting volume and playback speed
The document contains source code for several .NET programming examples including currency conversion, degree conversion, string manipulation, calculator, and employee salary calculation. The code demonstrates how to design forms, add controls, handle events, perform calculations and insert data into a SQL database. Output for the examples is not shown. The last example contains code to calculate an employee's gross pay and net pay based on their base pay and standard deductions.
The document describes Visual Studio .NET and Visual Basic .NET. It explains that Visual Studio .NET is an integrated development environment that allows programming applications using multiple .NET languages like Visual Basic, C#, and C++. It provides tools for writing code, debugging, and running applications. Visual Basic .NET is an object-oriented programming language used to create Windows applications with graphical user interfaces. The document provides step-by-step instructions for creating a simple Visual Basic .NET application with buttons and event handling code.
This document provides an overview of creating a Windows Forms application in C#. Key points include:
- A Windows Forms app contains Program.cs, which runs the form, and Form1.cs, which defines the form.
- Controls can be added to the form visually or through code and have properties like text and events like click handlers.
- Common tasks like input, output, and problem solving are similar to console apps but use Windows forms techniques instead of console output.
- Several exercises demonstrate creating GUIs and handling events and input/output for a Windows Forms application.
This document discusses events, delegates, multithreading, and garbage collection in VB.NET. It provides examples of how to handle events using delegates and the Handles keyword. It also describes how to create and manage threads for multithreading. Finally, it discusses how the .NET garbage collector automatically manages memory by collecting unused objects.
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...acijjournal
Unit testing has become an integral part of software development process as it ensures all your individual
functions behave in a way they should behave. Obtaining 100% code coverage out of unit test suit is
essential to ensure that all code paths are covered. This paper proposes a tool AutoCodeCoverGen that guarantees 100% code coverage. It also discusses the core idea behind tool and evolution of the tool Also, it shows how the tool differs from existing tools and what benefits it reaps for its users.
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
More Related Content
Similar to VISUAL BASIC PRATICAL FILE MSC COMPUTER SCIENCE.pdf
The document provides an overview of Visual Basic 6 and its key concepts. It discusses Visual Basic as an event-driven programming language used to build graphical user interfaces. It explains some of Visual Basic's main features like data access, ActiveX technologies, and internet capabilities. It also covers important Visual Basic concepts like windows, events, event-driven programming, interpreting and compiling code, and the Visual Basic integrated development environment.
Bottom of FormCreate your own FunctionFunctionsFor eac.docxAASTHA76
Bottom of Form
Create your own Function
Functions
For each discussion, provide a snipplet of pseudo-code for the Main using an example call to the Function as well as the pseudo-code for the Function.
For each discussion, do the problem you are assigned to as described by the letters below.
Discussion 1 - Using Pseudocode, create a Function that accepts one or more input Integer numbers and returns a float number. You should name your function appropriately as to what it does. Be sure to document your Function with header and in-line comments.
Provide a snipplet of psuedo-code for the Main using an example call to the Function.
Make sure the variable names in the Main are different that in the Function. In the Main, provide the prompts and get the user responses. Then pass the data into the Function. After the call to the Function include a print statements that indicates the returning value from the call to the Function.
Put Discussion 1 - problem no.X in the Subject area.
You are assigned the problem no. below as follows: If your Last Name begins with:
A-B - do no. 1
C-F - do no. 2
G-H - do no. 3
I-K - do no. 4
L - do no. 5
M-P - do no. 6
Q-T - do no. 7
U-Z - do no. 8
1)Calculate the Area of a circle. Input: one number
2)Calculate the Circumference a circle. Input: one number
3)Convert the temperature from Celcius to Farenheit Input: one number
4)Convert the temperature from Farenheit to Celcius. Input: one number
5)Calculate 6 times a number squared. Input: one number
6)Calculate 3 times the (sum of three numbers). Input: three numbers
7)Calculate the average of four numbers. Input: four numbers
8)Calculate 5 times the (difference of two numbers). Input two numbers
You may do additional problems, if you want.
Discussion 2:
Convert Discussion 1 to C-code. Don't for get to prototype your function before the main and to define your function after the main. Put Discussion 2 - problem no.X in the Subject area and submit a .txt (or .c) file for your code.
CMIS 102 Hands-On Lab
Week 6
Overview:
This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, Analysis, Design(program design, pseudocode), Test Plan, and implementation with C code. The example provided uses sequential, repetition, selection statements and two user-defined function.
Program Description:
This program will provide options for a user to calculate the square or cube of a positive Integer input by a user. The program will prompt the user to enter an Integer and then prompt the user if they want to calculate the square of the cube of the number. Based on the inputs of the user, the program will output the square of the cube of the positive integer. The program will then print the Integer and square or cube of the integer based on the user’s original choice. The program will continue to prompt the user for
Integers and their calculation choice until the user enters a negative int ...
This document provides instructions for a lab assignment involving arrays and strings. There are two programs to be completed:
1) A video game player program that stores player names and scores in arrays, calculates the average score, and identifies players below average.
2) A Pig Latin translator that takes a phrase as input, separates it into words stored in a string array, and converts each word to Pig Latin by moving initial consonants to the end and adding "ay".
Students are directed to use pseudocode, write and compile the C++ code, and include a screen shot and their code in a Word document for submission.
This document provides an overview of WinForms GUI programming in .NET. It discusses how event-driven programming works in WinForms applications and how Visual Studio supports drag-and-drop design of WinForms. It also describes some key concepts like forms, controls, properties and events. The document explains how to set up a basic WinForms application and interact with common controls like labels, text boxes and buttons.
The document discusses various VB.NET concepts including modules, classes, variables, data types, and operators. It provides code examples to demonstrate working with console and windows form applications in VB.NET, declaring variables with different access specifiers, and using arithmetic, concatenation, comparison, and logical operators.
The document provides instructions for running Python code in both interactive and script modes. It explains that in interactive mode, code is executed immediately after being typed, while scripts run entire files of code. Steps are given to start an interactive session in the terminal or IDLE and run script files with Python filename.py. Code examples are also provided to demonstrate basic Python operations in the interactive interpreter like arithmetic, variables, functions, strings and control flow.
The document describes an iLab assignment to modify an Employee class to demonstrate composition and interfaces. Key points:
- Create a Benefits class to hold an employee's benefits like health insurance, life insurance, and vacation.
- Integrate the Benefits class into the Employee class using composition.
- Create an abstract iEmployee interface to guarantee the Employee class implements the calculatePay method.
- The goal is to enhance the existing Employee class from previous labs by adding benefits through composition and using interfaces.
Chapter 1 Class 12 Computer Science Unit 1ssusera7a08a
The document discusses the basics of Python programming language. It provides an introduction to Python, describing how it is an interpreted, high-level and general-purpose programming language. It then covers Python features, data types, operators, and how to work in both interactive and script modes in Python. The document also discusses topics like variables, data handling, arithmetic operators, comparison operators, and more with examples.
The document discusses Python programming language. It provides an introduction to Python, describing it as an interpreted, high-level and general-purpose programming language. It then covers various data types in Python including numbers, strings, booleans, lists, tuples, sets and dictionaries. The document also discusses operators in Python like arithmetic, comparison, logical and bitwise operators. Finally, it explains how to work with Python in both interactive and script modes.
Devry cis 170 c i lab 5 of 7 arrays and stringsjody zoll
This document provides instructions for a lab assignment with two programs - one that analyzes test scores from multiple players and finds those below average, and another that converts words to "pig latin". It includes requirements, pseudocode, steps to create and run the programs in Visual Studio, and instructions to capture output screenshots and code in a Word document for submission.
Software engineering modeling lab lectures
engineering+ education purpose
This series of lectures was prepared for the third class of software engineering / Aliraqia University/ Baghdad/ Iraq.
In prepared these lectures, I depend on the YouTube to make it, the programs of the lectures are designed and executed by vb.net, discussions are also found here
These lectures are not finished yet, i will improve it in the future
Forgive me for anything wrong by mistake, I wish you can profit from these lectures
My regard
Marwa Moutaz/ M.Sc. studies of Communication Engineering / University of Technology/ Bagdad / Iraq.
The document discusses different types of loops in C++ including while, do-while, for, and switch-case statements. It provides examples of using each loop or statement to repeat operations a certain number of times or while a condition is met. Key examples include a countdown loop using while, calculating factorials with for, and a calculator program using switch-case to perform math operations.
This document provides an overview of Visual Basic 6.0 and how to create a basic application. It outlines the objectives of learning Visual Basic and describes key concepts like the event-driven nature of VB applications. The document explains the structure of a VB project, including forms, controls, properties, methods and events. It also demonstrates how to set control properties, write code, declare variables, and use common functions and operators. Finally, it provides examples for creating a stopwatch timer application and a basic text editor application in VB.
This document provides instructions for creating a basic antivirus program using Visual Basic 2010 in 3 steps:
1. Install Visual Basic 2010 and create a new project
2. Design the user interface with buttons, lists, tracks, and media players
3. Add code to each component to assign functions like opening files, playing audio, adjusting volume and playback speed
The document contains source code for several .NET programming examples including currency conversion, degree conversion, string manipulation, calculator, and employee salary calculation. The code demonstrates how to design forms, add controls, handle events, perform calculations and insert data into a SQL database. Output for the examples is not shown. The last example contains code to calculate an employee's gross pay and net pay based on their base pay and standard deductions.
The document describes Visual Studio .NET and Visual Basic .NET. It explains that Visual Studio .NET is an integrated development environment that allows programming applications using multiple .NET languages like Visual Basic, C#, and C++. It provides tools for writing code, debugging, and running applications. Visual Basic .NET is an object-oriented programming language used to create Windows applications with graphical user interfaces. The document provides step-by-step instructions for creating a simple Visual Basic .NET application with buttons and event handling code.
This document provides an overview of creating a Windows Forms application in C#. Key points include:
- A Windows Forms app contains Program.cs, which runs the form, and Form1.cs, which defines the form.
- Controls can be added to the form visually or through code and have properties like text and events like click handlers.
- Common tasks like input, output, and problem solving are similar to console apps but use Windows forms techniques instead of console output.
- Several exercises demonstrate creating GUIs and handling events and input/output for a Windows Forms application.
This document discusses events, delegates, multithreading, and garbage collection in VB.NET. It provides examples of how to handle events using delegates and the Handles keyword. It also describes how to create and manage threads for multithreading. Finally, it discusses how the .NET garbage collector automatically manages memory by collecting unused objects.
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...acijjournal
Unit testing has become an integral part of software development process as it ensures all your individual
functions behave in a way they should behave. Obtaining 100% code coverage out of unit test suit is
essential to ensure that all code paths are covered. This paper proposes a tool AutoCodeCoverGen that guarantees 100% code coverage. It also discusses the core idea behind tool and evolution of the tool Also, it shows how the tool differs from existing tools and what benefits it reaps for its users.
Similar to VISUAL BASIC PRATICAL FILE MSC COMPUTER SCIENCE.pdf (20)
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
Thinking of getting a dog? Be aware that breeds like Pit Bulls, Rottweilers, and German Shepherds can be loyal and dangerous. Proper training and socialization are crucial to preventing aggressive behaviors. Ensure safety by understanding their needs and always supervising interactions. Stay safe, and enjoy your furry friends!
Assessment and Planning in Educational technology.pptxKavitha Krishnan
In an education system, it is understood that assessment is only for the students, but on the other hand, the Assessment of teachers is also an important aspect of the education system that ensures teachers are providing high-quality instruction to students. The assessment process can be used to provide feedback and support for professional development, to inform decisions about teacher retention or promotion, or to evaluate teacher effectiveness for accountability purposes.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
हिंदी वर्णमाला पीपीटी, hindi alphabet PPT presentation, hindi varnamala PPT, Hindi Varnamala pdf, हिंदी स्वर, हिंदी व्यंजन, sikhiye hindi varnmala, dr. mulla adam ali, hindi language and literature, hindi alphabet with drawing, hindi alphabet pdf, hindi varnamala for childrens, hindi language, hindi varnamala practice for kids, https://www.drmullaadamali.com
1. Studocu is not sponsored or endorsed by any college or university
Vb-practical-file - VB complete notes for practical
Computer science (Kurukshetra University)
Studocu is not sponsored or endorsed by any college or university
Vb-practical-file - VB complete notes for practical
Computer science (Kurukshetra University)
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
2. LAB MANUAL FOR PRACTICAL
COURSES
MSc Computer Science 2nd
year
Practical File of
Visual Basic (CS-DE-27)
DIRECTORATE OF DISTANC EDUCATION
KURUKSHETRA UNIVERSITY, KURUKSHETRA.
HARYANA- 136119
PRACTICAL EXAMINATION -
Name- Mohit Roll No.-
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
3. EDUCATION DIRECTORATE OF DISTANCE
(Established by the State Legislature Act XII of 1956)
KURUKSHETRA UNIVERSITY,
KURUKSHETRA
Department of Computer Science
This is to certify that this is the bonafide record work of practical
work done by
Mr. MOHIT Reg.No. 22248593 Roll No.
Of MSc Computer Science 2nd
year ,Of Subject CS-DE-27
(Visual Basic), at the Directorate of Distance
Education, Kurukshetra University, Kurukshetra during
the academic year.
July 2022 - 2023 .
Internal Examiner External Examiner
Name- Mohit Roll No.-
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
4. Visual Basic (CS-DE- 27) Software Lab – II
CONTENTS
Sl.
No.
Title of the Exercise Page No.
1. Print the Sentence 04
2. String Concatenation 05
3. Vowel or Not 06
4. String Conversion 07
5. Simple Calculator 08
6. Online Examination 12
7. Loading of Control 14
8. Dynamic Menus 17
9. Analog Clock 19
10. Picture Viewer 23
11. Tic-Tac-Toe 27
12. Drag-Drop Recycle Bin 30
13. Traffic Light 32
14. Plotter 36
15. GP( Geometric Progression) 38
16. A Smart Audio Player 41
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
5. Excercise Number - 1: Print the sentence
Aim:
To write a program to print the sentence "Write First program in Visual basic"
Algorithm:
1. Start the application
2. To create a module
3. To declare the variable string as dimension
4. Assign any sentence to the variable as str
5. To display the sentence
6. End the Module
7. Deploy and run the program
Source Code:
Module Module1
Sub Main()
Dim str As String
str = "Write First program in Visual basic"
Console.WriteLine(str)
Console.ReadLine()
End Sub
End Module
Output:
Write First Program in Visual basic
Result:
Thus the program was executed and its output was verified.
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
6. Excercise Number - 2: String Concatenation
Aim:
To write a program to concatenate any two or more strings in Visual basic.
Algorithm:
1. Start the application
2. To create a module and declare the variable string as dimension
3. Assign any word to each of the variables
4. To concatenate all the words and print them
5. End the module
6. Deploy and run the program
Source Code:
Module Module1
Sub Main()
Dim str1, str2, str3 As
String str1 = "Visual"
str2 = "Basic"
str3 = "Program"
Console.WriteLine(str1 + " " + str2 + " " + str3)
Console.ReadLine()
End Sub
End Module
Output:
Visual basic program
Result:
Thus the program was executed and its output was verified.
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
7. Excercise Number - 3: Vowel or not
Aim:
To write a program to check whether a character is vowel or not.
Algorithm:
1. Start the application and create and design a form with needed buttons
2. Click the button to write the program in editor page
3. To declare the variable as string
4. To create textbox and assign the textbox values as variable
5. If the textbox values as vowel then the message box displays “The Given String is
vowel”
6. Otherwise the messagebox displays “The Given String is not vowel”
7. Deploy and run the program
Source Code:
Public Class Vowels
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim c As String
c = TextBox1.Text
If c = "a" Or c = "A" Or c = "e" Or c = "E" Or c = "i" Or c = "I" Or c = "o" Or c =
"O" Or c = "u" Or c = "U" Then
MsgBox("The Given String is
vowel") Else
MsgBox("The Given String is not
vowel") End If
End Sub
End Class
Output:
Result:
Thus the program was executed and its output was verified.
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
8. Excercise Number - 4: String Conversion
Aim:
To write a program to accept character for console and check the case of the character.
Algorithm:
1. Start the application
2. Open a new file and design the form with needed such controls as labelbox,
textbox,button.
3. Click the button to write the program in editor page
4. Check the string is lower or upper case
5. Deploy and run the program
Source Code:
Public Class Conversion
Private Sub Low_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Low.Click
TextBox2.Text = TextBox1.Text.ToLower
End Sub
Private Sub Upp_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Upp.Click
TextBox2.Text = TextBox1.Text.ToUpper
End Sub
End Class
Output:
Result:
Thus the program was executed and its output was verified.
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
9. Excercise Number - 5: Simple Calculator
Aim:
To write a program to develop a simple calculator for an arithmetic operations
Algorithm:
1. Start the application
2. Open a new file and design the form with needed such controls as labelbox,
textbox,button.
3. Click the button to write the program in editor page
4. Click the +,-,*,/ operator to prefer their respective operations
5. Use if else condition to do all the operations of arithmetic calculations
6. Deploy and run the program
Source code:
Public Class Form1
Dim frstnum As Decimal
Dim scndnum As Decimal
Dim operations As Integer
Dim operator_selector As Boolean = False
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "1"
Else
TextBox1.Text = "1"
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "2"
Else
TextBox1.Text = "2"
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "3"
Else
TextBox1.Text = "3"
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
10. If TextBox1.Text <> "0" Then
TextBox1.Text += "4"
Else
TextBox1.Text = "4"
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "5"
Else
TextBox1.Text = "5"
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button6.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "6"
Else
TextBox1.Text = "6"
End If
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button7.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "7"
Else
TextBox1.Text = "7"
End If
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button8.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "8"
Else
TextBox1.Text = "8"
End If
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button9.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "9"
Else
TextBox1.Text = "9"
End If
End Sub
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
11. Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button10.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "0"
End If
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button11.Click
frstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 1 '=+
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button12.Click
frstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 2 '=-
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button13.Click
frstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 3 '=*
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button14.Click
frstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operations = 4 '=/
End Sub
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button16.Click
If Not (TextBox1.Text.Contains(".")) Then
TextBox1.Text += "."
End If
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button15.Click
TextBox1.Text = "0"
End Sub
Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button17.Click
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
12. If operator_selector = True Then
scndnum = TextBox1.Text
If operations = 1 Then
TextBox1.Text = frstnum + scndnum
ElseIf operations = 2 Then
TextBox1.Text = frstnum - scndnum
ElseIf operations = 3 Then
TextBox1.Text = frstnum * scndnum
ElseIfscndnum = 0 Then
TextBox1.Text = "Error!"
Else
TextBox1.Text = frstnum / scndnum
End If
operator_selector = False
End If
End Sub
End Class
Output:
Result:
Thus the program was executed and its output was verified.
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
13. Excercise Number - 6: Online Examination
Aim:
To write a program to create Online Examination Using Timer.
Algorithm:
1. Start the application
2. Open a new file and design the form with needed such controls as labelbox,
textbox,button.
3. Click the button to write the editor page
4. Set a Timer as an interval = 1000 seconds
5. To declare all the variables
6. Radio button is used for the answer selection in the online exam
7. Use the message box to display the result
8. Deploy and run the program
Source Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Label3.Text = 20
Timer1.Enabled = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Label3.Visible = False
Dim total As Integer
total = 0
If RadioButton1.Checked = True Then
total += 1
End If
If RadioButton3.Checked = True Then
total += 1
End If
MsgBox("Your Mark is " & total)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If Label3.Text = 0 Then
Timer1.Enabled = False
MsgBox("Timeout")
Else
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
15. End ClassPublic Class Form1
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Label3.Text =
20
Timer1.Enabl
ed = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Label3.Visib
le = False
Dim total As
Integer total
= 0
If RadioButton1.Checked =
True Then total += 1
End If
If RadioButton3.Checked =
True Then total += 1
End If
MsgBox("Your Mark is
" & total) End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Timer1.Tick
If Label3.Text
= 0 Then
Timer1.Enabl
ed = False
MsgBox("Tim
eout") Else
Label3.Text =
Label3.Text - 1 End
Output:
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
16. Practical – 7
LOADING CONTROLS AT RUNTIME: Write a program which demonstrates the loading of
controls at runtime.
Dim i As Integer
Dim lblindex As Integer
Dim btnindex As Integer
Private Sub cmd_btn_Click(Index As Integer)
' first give the index =0 to command button at design time
Load cmd_btn(btnindex)
With cmd_btn(btnindex)
.Caption = "Button " & btnindex
.Left = 3800
.Top = 1200 + btnindex * 500
.Height = 300
.Visible = True
End With
btnindex = btnindex + 1
End Sub
Private Sub cmd_lbl_Click()
Set lblnew = Controls.Add("VB.Label", "Labels" & lblindex)
With lblnew
.Caption = "Label " & lblindex
.Left = 800
.Top = 1200 + lblindex * 500
.Visible = True
End With
lblindex = lblindex + 1
End Sub
Private Sub cmd_Remove_Button_Click()
If btnindex > 1 Then
btnindex = btnindex - 1
Unload cmd_btn(btnindex)
Else
MsgBox ("There is no Button to remove")
End If
End Sub
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
17. Private Sub cmd_remove_Label_Click()
If lblindex > 1 Then
lblindex = lblindex - 1
Me.Controls.Remove ("Labels" & lblindex)
Else
MsgBox ("There is no label to remove")
End If
End Sub
Private Sub cmd_Remove_Tbox_Click()
If i > 1 Then
i = i - 1
Me.Controls.Remove ("TextBox" & i)
Else
MsgBox ("There is no TextBox to remove")
End If
End Sub
Private Sub cmd_tbox_Click()
Set txtnew = Controls.Add("VB.TextBox", "TextBox" & i)
txtnew.Text = "TextBox " & i
' move left, top, width , height
txtnew.Move 2200, 1200 + i * 500, 1400, 20
txtnew.Visible = True
i = i + 1
End Sub
Private Sub Form_Load()
i = 1
btnindex = 1
lblindex = 1
End Sub
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
18. Practical – 8
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
19. DYNAMIC MENUS: Write a program which demonstrates the dynamic menus. For example
the recently visited files are added in menus which changes dynamically.
Dim Index As Integer
Private Sub cmd_execute_Click()
If Index < 5 Then
Index = Index + 1
Load FileRecent(Index)
FileRecent(Index).Enabled = True
End If
Dim i As Integer
i = Index
Do While i > 1
FileRecent(i).Caption = FileRecent(i - 1).Caption
i = i - 1
Loop
FileRecent(1).Caption = tbox_command.Text
tbox_command.Text = ""
tbox_command.SetFocus
End Sub
Private Sub FileExit_Click()
End
End Sub
Private Sub FileRecent_Click(Index As Integer)
tbox_command.Text = FileRecent(Index).Caption
End Sub
Private Sub FileReset_Click()
For i = 1 To Index
Unload FileRecent(i)
Next
End Sub
Private Sub Form_Load()
FileRecent(0).Enabled = False
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
20. End Sub
Practical – 9
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
21. ANALOG CLOCK: Write a program to create an analog clock, which shows all the three
hands (Hour, Minute and second). You can add an option to change the background of the
clock.
Dim min, hour As Integer
Const PI = 3.14159265 'Pi constant
Dim theta As Single
Dim dtheta As Single
Dim second As Long
Dim cx As Single
Dim cy As Single
Dim radius As Single
Const stheta As Single = 4.7142857
Private Sub btn_image_Click()
CommonDialog1.Filter = "Graphics|*.bmp;*.gif;*.jpg|Text File|*.txt|All Files|*.*"
CommonDialog1.ShowOpen
If Not Picture1.AutoRedraw Then Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture(CommonDialog1.Filename)
Picture1.PaintPicture Picture1.Picture, 0, 0, 5000, 5000
gettime
End Sub
Public Sub gettime()
theta = stheta
dtheta = 2 * PI / 60
cx = 2500
cy = 2500
radius = 2300
second = Format(Time, "s") + Format(Time, "n") * 60 + (Format(Time, "h") Mod 12) *
3600
min = second / 60
hour = Format(Time, "h") Mod 12
LineSec.X1 = 2500
LineSec.Y1 = 2500
theta = stheta + (second Mod 60) * dtheta
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
22. LineSec.x2 = cx + (radius - 100) * Cos(theta)
LineSec.y2 = cy + (radius - 100) * Sin(theta)
line_minute.X1 = 2500
line_minute.Y1 = 2500
line_Hour.X1 = 2500
line_Hour.Y1 = 2500
line_Hour.x2 = cx + (radius - 200) * Cos(stheta + (2 * PI / 3600) * min * 5)
line_Hour.y2 = cy + (radius - 200) * Sin(stheta + (2 * PI / 3600) * min * 5)
End Sub
Private Sub cmd_ForeColor_Click()
CommonDialog1.ShowColor
For i = 0 To Label14.Count - 1
Label14(i).ForeColor = CommonDialog1.color
Next i
Shape1.BorderColor = CommonDialog1.color
DrawCircle 2500, 2500, 2400, 60, CommonDialog1.color
End Sub
Private Sub Form_Load()
'LoadDots
DrawCircle 2500, 2500, 2400, 60
gettime
End Sub
Private Sub Timer2_Timer()
second = second + 1
theta = theta + dtheta
line_minute.x2 = cx + (radius - 100) * Cos(stheta + (2 * PI / 3600) * second)
line_minute.y2 = cy + (radius - 100) * Sin(stheta + (2 * PI / 3600) * second)
If second Mod 60 = 0 Then
theta = 4.7142857
min = min + 1
line_Hour.x2 = cx + (radius - 200) * Cos(stheta + (2 * PI / 3600) * min * 5)
line_Hour.y2 = cy + (radius - 200) * Sin(stheta + (2 * PI / 3600) * min * 5)
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
23. If second = 43200 Then second = 0
End If
If min = 720 Then
min = 0
End If
X = cx + radius * Cos(theta)
Y = cy + radius * Sin(theta)
LineSec.x2 = X
LineSec.y2 = Y
End Sub
Private Sub DrawCircle(ByVal cx As Single, ByVal cy As Single, ByVal radius As Single,
ByVal num_segments As Integer, Optional fcolor As ColorConstants)
Const PI = 3.14159265
Dim X As Single
Dim Y As Single
Dim theta As Single
Dim dtheta As Single
Dim second As Integer
For i = 1 To Dot.Count - 1
Unload Dot(i)
Next
dtheta = 2 * PI / num_segments
theta = stheta
For seg = 1 To num_segments
theta = theta + dtheta
X = cx + radius * Cos(theta)
Y = cy + radius * Sin(theta)
Load Dot(seg)
Dot(seg).X1 = X
Dot(seg).Y1 = Y
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
24. Dot(seg).x2 = X + 2
Dot(seg).y2 = Y + 2
Dot(seg).BorderWidth = 3
If seg Mod 5 = 0 Then
Dot(seg).BorderWidth = 5
Else
Dot(seg).BorderColor = fcolor
End If
Dot(seg).Visible = True
Next seg
End Sub
Practical – 10
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
25. PICTURE VIEWER: Create a program that enables the users to open and choose files from
the folders in their PC. The picture viewer provides the functionality to move to the NEXT
and PREVIOUS photos, ZOOM IN & ZOOM OUT
Dim Index As Integer
Dim path As String
Dim X, Y As Integer
Private Sub bnt_prev_Click()
If Index > 0 Then
Index = Index - 1
End If
path = File1.path
If Right(path, Len(path) - 2) <> "" Then
path = path & ""
End If
PictureViewer.Picture1.Picture = LoadPicture(path & File1.List(Index))
PictureViewer.Picture1.PaintPicture PictureViewer.Picture1.Picture, 0, 0, 800, 600
End Sub
Private Sub btn_next_Click()
If Index < File1.ListCount - 1 Then
Index = Index + 1
path = File1.path
If Right(path, Len(path) - 2) <> "" Then
path = path & ""
End If
Picture1.Picture = LoadPicture(path & File1.List(Index))
Picture1.PaintPicture Picture1.Picture, 0, 0, 800, 600
Picture2.Picture = LoadPicture(path & File1.List(Index))
End If
End Sub
Private Sub btn_open_Click()
openFolderDialog.Show 1
End Sub
Private Sub btn_zoomin_Click()
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
26. If Picture1.Picture = 0 Then
Exit Sub
End If
X = X + 80
Y = Y + 60
Picture1.Height = Y
Picture1.Width = X
Picture1.PaintPicture Picture1.Picture, 0, 0, X, Y
If X > Pic_holder.ScaleWidth Then
HScroll1.Max = X - Pic_holder.ScaleWidth
VScroll1.Max = Y - Pic_holder.ScaleHeight
Else
HScroll1.Max = 0
VScroll1.Max = 0
End If
End Sub
Private Sub btn_zoomout_Click()
If Picture1.Picture = 0 Then
Exit Sub
End If
If X > 160 Then
X = X - 80
Y = Y - 60
End If
Picture1.Height = Y
Picture1.Width = X
Picture1.PaintPicture Picture1.Picture, 0, 0, X, Y
If Picture1.ScaleWidth - Pic_holder.ScaleWidth > 0 Then
HScroll1.Max = Picture1.ScaleWidth - Pic_holder.ScaleWidth
VScroll1.Max = Picture1.ScaleHeight - Pic_holder.ScaleHeight
Else
HScroll1.Max = 0
VScroll1.Max = 0
End If
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
27. End Sub
Private Sub Form_Load()
X = 800
Y = 600
'Set up picturebox
With Picture1
.ScaleMode = vbPixels
.AutoRedraw = True
.DrawMode = vbInvert
.DrawStyle = SelDrawType
.BackColor = vbWhite
.MousePointer = vbCrosshair
.Left = 0
.Top = 0
.ScaleHeight = Pic_holder.ScaleHeight
.ScaleWidth = Pic_holder.ScaleWidth
End With
Picture2.ScaleHeight = Picture1.ScaleHeight
Picture2.ScaleWidth = Picture1.ScaleWidth
HScroll1.Max = Picture1.ScaleWidth - Pic_holder.ScaleWidth
HScroll1.min = 0
VScroll1.Max = Picture1.ScaleHeight - Pic_holder.ScaleHeight
HScroll1.min = 0
End Sub
Private Sub HScroll1_Change()
Picture1.Left = -HScroll1.Value
End Sub
Private Sub VScroll1_Change()
Picture1.Top = -VScroll1.Value
End Sub
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
28. Practical – 11
TIC- TAC- TOE: Develop a program Tic Tac Toe in VB so that you can play the game
virtually. First of all, you need to draw the interface with four straight lines, then insert nine
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
29. image controls and make them an array, Image1 (0) to Image1 (8). Secondly, insert two
pictures, one is a circle and the other one is a cross to represent player 1 and player2.
Dim sym As String
Dim winr(9) As String
Private Sub Form_Load()
sym = "X"
Dim i As Integer
For i = 0 To 8
winr(i) = i
Next i
End Sub
Private Sub Label1_Change()
If Label1.Caption = "Player 1" Then
sym = "X"
Else
sym = "0"
End If
End Sub
Private Sub lbl_gstatus_Click(Index As Integer)
If lbl_gstatus(Index).Caption = "" Then
lbl_gstatus(Index).Caption = sym
winr(Index) = sym
If Label1.Caption = "Player 1" Then
Label1.Caption = "Player 2"
Else
Label1.Caption = "Player 1"
End If
check
End If
End Sub
Function check()
Dim i As Integer
Dim won As Boolean
Dim psymbol As String
If winr(0) = winr(1) And winr(1) = winr(2) Then
won = True
psymbol = winr(0)
ElseIf winr(2) = winr(4) And winr(4) = winr(6) Then
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
30. won = True
psymbol = winr(2)
ElseIf winr(0) = winr(3) And winr(3) = winr(6) Then
won = True
psymbol = winr(0)
ElseIf winr(1) = winr(4) And winr(4) = winr(7) Then
won = True
psymbol = winr(1)
ElseIf winr(2) = winr(5) And winr(5) = winr(8) Then
won = True
psymbol = winr(2)
ElseIf winr(0) = winr(1) And winr(1) = winr(2) Then
won = True
psymbol = winr(0)
ElseIf winr(3) = winr(4) And winr(4) = winr(5) Then
won = True
psymbol = winr(3)
ElseIf winr(6) = winr(7) And winr(7) = winr(8) Then
won = True
psymbol = winr(6)
End If
If won = True Then
Dim pno As Integer
If psymbol = "X" Then
pno = 1
Else
pno = 2
End If
MsgBox (" Player " & pno & " won")
won = False
For i = 0 To 8
winr(i) = i
lbl_gstatus(i).Caption = ""
Label1.Caption = "Player 1"
Next
End If
End Function
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
31. Practical – 12
A DRAG & DROP RECYCLE_BIN: Make a drag and drop program that resembles a recycle
bin. Drag and drop is a common windows application where you can drag and drop an object
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
32. such as a file into a folder or into a recycle bin. This capability can be easily programmed in
visual basic
Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
Source.Visible = False
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As
Single)
If Button = vbRightButton Then
PopupMenu RestoreMenu, vbPopupMenuRightAlign
End If
End Sub
Private Sub Restore_Click()
Image1.Visible = True
Image2.Visible = True
Image3.Visible = True
Image4.Visible = True
End Sub
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
33. Practical – 13
TRAFFIC LIGHT: Create a Traffic light program in which, one can insert one timer and sets
its interval according to its desire. Suppose set it to 3000, which is equivalent to 3 seconds.
Next you insert three shapes and set their shape properties to circle and fill the colors.
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
34. Dim status(4) As Boolean
Const interval As Integer = 1000
Dim wait As Integer
Dim waittime(3) As Integer
Dim stage, t1, t2, t3, t4 As Integer
Private Sub Command1_Click()
Me.FillColor = vbRed
Me.FillStyle = vbSolid
Call light(250, 50, 1)
Call light(100, 200, 1)
Call light(400, 200, 1)
Call light(250, 300, 1)
waittime(0) = 10
waittime(1) = 4
waittime(2) = 8
Timer2.Enabled = True
Timer1.Enabled = True
t1 = waittime(0) + waittime(1)
t2 = (waittime(1) + waittime(2)) * 2 + 1
t3 = (waittime(1) + waittime(2)) * 3 + 1
t4 = (waittime(1) + waittime(2)) * 4 + 1
Label1.Left = 320
Label1.Top = 50
Label2.Left = 320
Label2.Top = 300
Label3.Left = 170
Label3.Top = 200
Label4.Left = 470
Label4.Top = 200
wait = 10
stage = 0
End Sub
Function light(X As Integer, Y As Integer, Optional c As Integer)
Call rectangle(X, Y, X + 50, Y + 100)
Call fillcircle(X + 25, Y + 20, vbWhite)
Call fillcircle(X + 25, Y + 50, vbWhite)
Call fillcircle(X + 25, Y + 80, vbWhite)
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
35. Select Case c
Case 1:
Call fillcircle(X + 25, Y + 20, vbRed)
Case 2:
Call fillcircle(X + 25, Y + 50, vbYellow)
Case 3:
Call fillcircle(X + 25, Y + 80, vbGreen)
End Select
End Function
Function rectangle(X As Integer, Y As Integer, x2 As Integer, y2 As Integer)
Me.Line (X, Y)-(X, y2), vbRed
Me.Line (x2, Y)-(x2, y2), vbRed
Me.Line (X, Y)-(x2, Y), vbRed
Me.Line (X, y2)-(x2, y2), vbRed
End Function
Function fillcircle(X As Integer, Y As Integer, color As ColorConstants)
Me.FillColor = color
Me.Circle (X, Y), 10, vbBlack
End Function
Private Sub Timer1_Timer()
t1 = t1 - 1
t2 = t2 - 1
t3 = t3 - 1
t4 = t4 - 1
Label1.Caption = t1
Label2.Caption = t2
Label3.Caption = t3
Label4.Caption = t4
End Sub
Private Sub Timer2_Timer()
stage = stage + 1
Select Case stage
Case 1:
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
37. Timer2.interval = interval * waittime(1)
stage = 1
End Select
End Sub
Practical – 14
CUBIC FUNCTION GRAPH PLOTTER: Make a program that enables users to input the
coefficients of a cubic equation and draw its graph. The cubic equation takes the form
ax3
+bx2
+cx+d.
Private Sub btn_cls_Click()
pic_graph.Cls
End Sub
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
38. Private Sub cmd_draw_Click()
Dim a, b, c, d As Integer
Dim w, v As Double
a = Val(tbox_a.Text)
b = Val(tbox_b.Text)
c = Val(tbox_c.Text)
d = Val(tbox_d.Text)
'Using a scale of 0.5 cm to represent i unit to draw the graph
' Need to make some transformation as the coordinates in VB start from top left
For w = 0 To 10 Step 0.001
v = a * (5 - w) ^ 3 + b * (5 - w) ^ 2 + c * (5 - w) + d
pic_graph.PSet (w, 5 - v)
Next w
End Sub
Private Sub Form_Load()
Line_x.X1 = 0
Line_x.x2 = pic_graph.ScaleWidth
Line_x.Y1 = pic_graph.ScaleHeight / 2
Line_x.y2 = pic_graph.ScaleHeight / 2
Line_y.X1 = pic_graph.ScaleWidth / 2
Line_y.x2 = pic_graph.ScaleWidth / 2
Line_y.Y1 = 0
Line_y.y2 = pic_graph.ScaleHeight
End Sub
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
39. Practical – 15
GEOMETRIC PROGRESSION: Make a Visual Basic program that can compute a
geometric progression and display the results in a list box.
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
40. Private Sub btn_sum_Click()
Dim a, n As Integer
Dim r As Single
If check() = False Then
MsgBox ("Required fields are empty")
Exit Sub
End If
If opt_inputbox.Value Then
a = InputBox("First Term", "Geometric Progression", 1)
r = InputBox("Common Ratio", "Geometric Progression", 1)
n = InputBox("How many terms", "Geometric Progression", 1)
Else
a = tbox_fn.Text
r = tbox_r.Text
n = tbox_terms.Text
End If
Dim s As Single
If r > 1 Then
s = (a * ((r ^ n) - 1)) / (r - 1)
Else
s = (a * (1 - (r ^ n))) / (1 - r)
End If
MsgBox ("The sum is " & s)
End Sub
Private Sub btn_term_Click()
Dim a, n As Integer
Dim r As Single
If check() = False Then
MsgBox ("Required fields are empty")
Exit Sub
End If
If opt_inputbox.Value Then
a = InputBox("First Term", "Geometric Progression", 1)
r = InputBox("Common Ratio", "Geometric Progression", 1)
n = InputBox("Which Term you want to display", "Geometric Progression", 1)
Else
a = tbox_fn.Text
r = tbox_r.Text
n = tbox_terms.Text
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
41. End If
MsgBox ("The " & n & "th term is " & a * (r ^ (n - 1)))
End Sub
Private Sub cmd_Clear_Click()
List1.Clear
End Sub
Private Sub cmd_series_Click()
If check() = False Then
MsgBox ("Required fields are empty")
Exit Sub
End If
cmd_Clear_Click
Dim f, n, terms As Integer
Dim r As Single
f = tbox_fn.Text
r = tbox_r.Text
terms = tbox_terms.Text
List1.AddItem "Term" & vbTab & "Value"
List1.AddItem "-----------------------"
n = 1
Do
List1.AddItem n & vbTab & f * (r ^ (n - 1))
n = n + 1
Loop While n <= terms
End Sub
Function check() As Boolean
If tbox_fn.Text = "" Then
check = False
ElseIf tbox_r.Text = "" Then
check = False
ElseIf tbox_terms.Text = "" Then
check = False
Else
check = True
End If
End Function
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
42. Practical – 16
A SMART AUDIO PLAYER: Write a program to create a player that enables you to play
midi and wave files in your hard drives or floppy A or CDROM. It should allow you to change
drives and search for the particular sound file that you wish to play. In this program, you have
to add a Combo box, a List Box, a Text Box, a Drive List Box, a command button you label as
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
43. "PLAY", another command button you label as "STOP", and one more command button you
label as "EXIT". You have to add in MMControl and make it invisible.
Dim i As Integer
Private Sub btn_exit_Click()
End
End Sub
Private Sub btn_Play_Click()
If File1.ListCount = 0 Then Exit Sub
Timer1.Enabled = True
Slider1.Value = 0
MMControl1.Command = "Close"
MMControl1.Filename = File1.path & "" & File1.List(i)
MMControl1.Command = "Open"
MMControl1.Command = "Play"
File1.Selected(i) = True
i = i + 1
If i >= File1.ListCount Then
i = 0
End If
End Sub
Private Sub btn_Stop_Click()
If btn_Stop.Caption = "Resume" Then
MMControl1.Command = "Play"
btn_Stop.Caption = "Pause"
Else
MMControl1.Command = "Pause"
btn_Stop.Caption = "Resume"
End If
End Sub
Private Sub cbox_pattern_Click()
If cbox_pattern.ListIndex = 0 Then
File1.Pattern = "*.wav;*.midi"
Else
File1.Pattern = "*.mp3;*.wav;*.mp4;*.mpeg;*.avi;*.dat"
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
44. End If
End Sub
Private Sub Dir1_Change()
File1.path = Dir1.path
End Sub
Private Sub Drive1_Change()
Dir1.path = Drive1.Drive
End Sub
Private Sub File1_Click()
i = File1.ListIndex
btn_Play_Click
End Sub
Private Sub Form_Load()
File1.Pattern = "*.midi;*.wav"
MMControl1.PlayEnabled = True
MMControl1.AutoEnable = True
End Sub
Private Sub Timer1_Timer()
Slider1.Value = Round(MMControl1.Position / MMControl1.Length * 100)
End Sub
Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983
45. Name- Mohit Roll No. -
Downloaded by BALWAN SAINI (sainibalwan86@gmail.com)
lOMoARcPSD|28417983