To enter the number in decimals Label 1 To show total. Text:...

Similar documents
In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result.

โปรแกรมช วยทดสอบหม อแปลงกระแส

VISUAL BASIC II CC111 INTRODUCTION TO COMPUTERS

Learning VB.Net. Tutorial 17 Classes

Learning VB.Net. Tutorial 10 Collections

FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants

Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date :

A Second Visual BASIC Application : Greetings

Year 12 : Visual Basic Tutorial.

Objectives. After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism

Mr.Khaled Anwar ( )

A Complete Tutorial for Beginners LIEW VOON KIONG

Lab 3 The High-Low Game

Revision for Final Examination (Second Semester) Grade 9

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = Label1.

Chapter 2 Exploration of a Visual Basic.Net Application

Repetition Structures

1. Create your First VB.Net Program Hello World

Learning VB.Net. Tutorial 15 Structures

Connection Example. Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date :

Programming with Visual Studio Higher (v. 2013)

VB FUNCTIONS AND OPERATORS

Tutorial 03 understanding controls : buttons, text boxes

PROGRAMMING ASSIGNMENT: MOVIE QUIZ

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals

C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions

CT862 Section 1 Introduction

DEVELOPING OBJECT ORIENTED APPLICATIONS

Computing Science Unit 1

I101/B100 Problem Solving with Computers

Decision Structures. Start. Do I have a test in morning? Study for test. Watch TV tonight. Stop

Developing Student Programming and Problem-Solving Skills With Visual Basic

CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration. MIS 15 Introduction to Business Programming. Programming Assignment 3 (P3)

Lab 4: Adding a Windows User-Interface

Learning VB.Net. Tutorial 19 Classes and Inheritance

Else. End If End Sub End Class. PDF created with pdffactory trial version

Visual Basic 2008 Anne Boehm

First start a new Windows Form Application from C# and name it Interest Calculator. We need 3 text boxes. 4 labels. 1 button

Code: Week 13. Write a Program to perform Money Conversion. Public Class Form1

BSc (Hons) Computer Science with. Network Security. BSc (Hons) Business Information Systems. Examinations for 2018 / Semester 1

DRAWING AND MOVING IMAGES

"!#... )*! "!# )+, -./ 01 $

S.2 Computer Literacy Question-Answer Book

Check out the demo video of this application so you know what you will be making in this tutorial.

OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class

DO NOT COPY AMIT PHOTOSTUDIO

超音波モータ制御プログラムの作成 (v1.2.1)

Visual Basic: Opdracht Structuur

Visual Basic 2008 The programming part

Chapter. Web Applications

Getting Started with Visual Basic.NET

Level 3 Computing Year 2 Lecturer: Phil Smith

Tally.ERP 9. New Indian Rupee Symbol in Tally.ERP 9

IS 320 A/B Winter 1998 Page 1 Exam 1

Herefordshire College of Technology Centre Edexcel BTEC Level 3 Extended Diploma in Information Technology (Assignment 1 of 3)

hp calculators HP 20b Using Memories to Solve Problems Constant memory and planning Memory registers Other memory locations

How to Validate DataGridView Input

How to use data sources with databases (part 1)

Tutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic

GUI Design and Event- Driven Programming

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types

Introduction. Getting Started with Visual Basic Steps:-

Learning VB.Net. Tutorial 16 Modules

PURPLE PORTAL. Tiered Bandwidth Guide

IRESS Depth - Web Services Version 4 Walkthrough Visual Basic 2008 sample to retrieve IRESS Depth information

IOS Plus Trade - Web Services Version 4 Walkthrough

Classes in C# namespace classtest { public class myclass { public myclass() { } } }

IT3101 -Rapid Application Development Second Year- First Semester. Practical 01. Visual Basic.NET Environment.

SCRIPT REFERENCE. UBot Studio Version 4. The Selectors

Santiago Canyon College Computer Science

C16 Visual Basic Net Programming

Savoy ActiveX Control User Guide

Running the Altair SIMH from.net programs

How to Create Fields in Microsoft CRM Online

The Filter Property Selecting a File The Save Menu The SaveFileDialog Control The Edit Menu The Copy Menu...

Disclaimer. Trademarks. Liability

HOUR 4 Understanding Events

MATFOR In Visual Basic

Tutorial 5 Completing the Inventory Application Introducing Programming

The New Brew-CQ Synchronous Sockets and Threading

Activating AspxCodeGen 4.0

ISM 3253 Exam I Spring 2009

Lecture 10 OOP and VB.Net

Menus, Common Dialog Controls, Context Menus, Sub Procedures, and Functions

CS708 Lecture Notes. Visual Basic.NET Object-Oriented Programming. Implementing Client/Server Architectures. Part (I of?) (Lecture Notes 5A)

A Simple Guide to Using SPSS (Statistical Package for the. Introduction. Steps for Analyzing Data. Social Sciences) for Windows

How to work with data sources and datasets

VISUAL BASIC 2005 EXPRESS: NOW PLAYING

Interacting with External Applications

UNIT 5: DISCRETE FOURIER TRANSFORM

Private Sub Cours_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Disclaimer. Trademarks. Liability

Lab 6 Insert controls in web form

Final Exam 7:00-10:00pm, April 14, 2008

Easy Cart User Manual

MapWindow Plug-in Development

This PDF was generated in real-time using DynamicPDF; Generator for.net.

Departme and. Computer. CS Intro to. Science with. Objectives: The main. for a problem. of Programming. Syntax Set of rules Similar to.

Windows 7 Control Pack for WinForms

Transcription:

Visual Basic tutorial - currency converter We will use visual studio to create a currency converter where we can convert a UK currency pound to other currencies. This is the interface for the application. Lets look at these closely Radio Button 1 Text: Euro Radio Button 2 Text: Rupee Radio Button 3 Text: Dollar Radio Button 4 Text: JPY Radio Button 5 Text: AUD Radio Button 6 Text: CNY Textbox To enter the number in decimals Label 1 To show total. Text:... Label 2 Text: Total: Label 3 Text: to others Button Text: Convert First step is lets double click on the button This will automatically add this button1_click function to the code. Right before the that function lets declare the currency variable.

We are declaring a double variable because double can contain decimal numbers in a very large amount. inside an integer we can only hold 10, 11, 12, 13 or -10, -11, -12, or -13 whole numbers. However to ensure we are achieving the right calculation for currency we need to use decimal numbers such as 3.20 or $100.99 and so on. Now let's add this highlighted line inside the button 1 click function. This like is taking the label 1 and inserting our currency converting calculations to it. We are declaring to change the label 1 text, we will take the value from the currency variable and multiply it by the number user enters inside the text box 1. Now we need to give the currency variable some value depending on the radio button chosen. Before we do that lets look at some current currency exchange rates.

This is YAHOO CURRENCY CONVERTER. Google it. At this moment here are the exchange rates for the currency we are looking for Our currency Exchange rate 1 1.2922 Euro 1 1.4219 Dollar 1 160.1115 JPY 1 1.9088 AUD 1 95.7575 Rupee 1 9.2498 CNY We can go in 2 decimal points for example change euro from 1.2922 to 1.29 and so on. Double click on the Euro radio button Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged radio button 1 checked changed function will inserted automatically. inside that function before the end sub we add the. Here we are using our global variable and giving it a value.

Now double click on the rupee radio button Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged currency = 95.75 Radio button 3 checked changed function is now inserted by visual studio and inside that we change the currency value to 95.75, You get the idea now. Lets add the rest. Here is the final code Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged currency = 95.75 Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged currency = 1.42 Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged currency = 160.11

Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged currency = 1.9 Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged currency = 9.24 Now lets test the program As you can see the program is responding the currency change and its giving us the right value for 1 pound. Try out your program. There is an alternative way to do this by using IF statement and keeping our program rather simple then before. As you can see we have 6 functions running behind the scene right now. How about we change it to just one function and a few IF statements instead. Lets try If (RadioButton1.Checked = True) Then If (RadioButton2.Checked = True) Then currency = 160.11

If (RadioButton3.Checked = True) Then currency = 95.75 If (RadioButton4.Checked = True) Then currency = 1.42 If (RadioButton5.Checked = True) Then currency = 1.9 If (RadioButton6.Checked = True) Then currency = 9.24 It still works as the same. For the next task Add some more currencies you want to change and see how that works out.