際際滷

際際滷Share a Scribd company logo
Visual BASIC .NET 2012
PART 21-COMBOBOX
Dr. GIRIJA NARASIMHAN 1
This slides are available http://slideshare.net /nbgirija
Dr. GIRIJA NARASIMHAN 2
This tutorial only for beginners , those
who dont have any knowledge about
any programming language skill and
application design.
Dr.GIRIJA NARASIMHAN 3
Public Class Form6
Private Sub Form6_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("Tennis")
ComboBox1.Items.Add("Cricket")
ComboBox1.Items.Add("Football")
ComboBox1.Items.Add("Basket ball")
ComboBox1.Items.Add("Boating")
End Sub
Dr.GIRIJA NARASIMHAN 4
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim fees, tax As Integer
If ComboBox1.SelectedItem = "Tennis" And Val(TextBox1.Text) < 5 Then
fees = 100
tax = fees * 10 / 100
ElseIf ComboBox1.Text = "Cricket" And Val(TextBox1.Text) < 5 Then
fees = 80
tax = fees * 5 / 100
ElseIf ComboBox1.SelectedIndex = 2 And Val(TextBox1.Text) < 5 Then
fees = 60
tax = fees * 3 / 100
Else
fees = 40
tax = 0
End If
MessageBox.Show(ComboBox1.SelectedItem & vbNewLine & "fees = " & fees & vbNewLine
& " tax = " & tax)
End Sub
End Class

More Related Content

Part21 combobox vb.net

  • 1. Visual BASIC .NET 2012 PART 21-COMBOBOX Dr. GIRIJA NARASIMHAN 1 This slides are available http://slideshare.net /nbgirija
  • 2. Dr. GIRIJA NARASIMHAN 2 This tutorial only for beginners , those who dont have any knowledge about any programming language skill and application design.
  • 3. Dr.GIRIJA NARASIMHAN 3 Public Class Form6 Private Sub Form6_Load(sender As Object, e As EventArgs) Handles MyBase.Load ComboBox1.Items.Add("Tennis") ComboBox1.Items.Add("Cricket") ComboBox1.Items.Add("Football") ComboBox1.Items.Add("Basket ball") ComboBox1.Items.Add("Boating") End Sub
  • 4. Dr.GIRIJA NARASIMHAN 4 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim fees, tax As Integer If ComboBox1.SelectedItem = "Tennis" And Val(TextBox1.Text) < 5 Then fees = 100 tax = fees * 10 / 100 ElseIf ComboBox1.Text = "Cricket" And Val(TextBox1.Text) < 5 Then fees = 80 tax = fees * 5 / 100 ElseIf ComboBox1.SelectedIndex = 2 And Val(TextBox1.Text) < 5 Then fees = 60 tax = fees * 3 / 100 Else fees = 40 tax = 0 End If MessageBox.Show(ComboBox1.SelectedItem & vbNewLine & "fees = " & fees & vbNewLine & " tax = " & tax) End Sub End Class