Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Conversion of weight units using VB.Net

Author: DevASP
Download Source Code : 519_weight_converter.zip

In this simple article you will learn that how you can make an application which converts the weight units.

Create New Project of windows application in VB and drag three labels, two combo boxes, one numeric up down and one buttons on the form. Now write code against following event: 

 

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

 

        If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 0 Then

            Label3.Text = NumericUpDown1.Value

        End If

        If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 1 Then

            Label3.Text = NumericUpDown1.Value * 1000

        End If

        If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 2 Then

            Label3.Text = NumericUpDown1.Value * 1000000

        End If

 

        If ComboBox1.SelectedIndex = 1 And ComboBox2.SelectedIndex = 0 Then

            Label3.Text = NumericUpDown1.Value / 1000

        End If

        If ComboBox1.SelectedIndex = 1 And ComboBox2.SelectedIndex = 1 Then

            Label3.Text = NumericUpDown1.Value

        End If

        If ComboBox1.SelectedIndex = 1 And ComboBox2.SelectedIndex = 2 Then

            Label3.Text = NumericUpDown1.Value * 1000

        End If

 

 

 

        If ComboBox1.SelectedIndex = 2 And ComboBox2.SelectedIndex = 0 Then

            Label3.Text = NumericUpDown1.Value / 1000000

        End If

        If ComboBox1.SelectedIndex = 2 And ComboBox2.SelectedIndex = 1 Then

            Label3.Text = NumericUpDown1.Value / 1000

        End If

        If ComboBox1.SelectedIndex = 2 And ComboBox2.SelectedIndex = 2 Then

            Label3.Text = NumericUpDown1.Value

        End If

 

End Sub

 

 

 

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

 

        Me.BackColor = Color.LightGray

        Me.Text = "DEVASP"

 

        ComboBox1.SelectedIndex = 0

        ComboBox2.SelectedIndex = 0

        NumericUpDown1.Minimum = 0

        NumericUpDown1.Maximum = 1000000000

 

End Sub

Article Comments
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Posted on 2/9/2007 8:50:41 PM by aaron

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

Posted on 2/9/2007 8:57:28 PM by aron

InvalidArgument=Value of '0' is not valid for 'SelectedIndex'.
Parameter name: SelectedIndex

Posted on 2/12/2010 5:51:46 AM by adrian

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How can make an application which convert Fahrenheit temperatures into Celsius and Celsius to Fahrenheit Using VB.Net

Disclaimer - Privacy
© 2002-2017 DevASP.net