0% found this document useful (0 votes)
20 views

Protected Sub DropDownList2

This document contains code for handling events from dropdown lists and list boxes on a web form. It sets the visibility of labels and list boxes depending on the selected items in the dropdowns and list boxes. When an item is selected from the second list box, it calculates a total price based on the selected item and displays it in a label.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Protected Sub DropDownList2

This document contains code for handling events from dropdown lists and list boxes on a web form. It sets the visibility of labels and list boxes depending on the selected items in the dropdowns and list boxes. When an item is selected from the second list box, it calculates a total price based on the selected item and displays it in a label.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Protected Sub DropDownList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList2.SelectedIndexChanged If DropDownList2.SelectedItem.Value = "Samsung" Then Label1.Visible = True ListBox1.

Visible = True Else Label1.Visible = False ListBox1.Visible = False End If If DropDownList2.SelectedItem.Value = "ViewSonic" Then Label2.Visible = True ListBox2.Visible = True Else Label2.Visible = False ListBox2.Visible = False End If End Sub Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged If ListBox1.SelectedItem.Text = "Monitor" Then p = 3500 total = p End If If ListBox1.SelectedItem.Text = "Mouse" Then p = 250 total = p End If If ListBox1.SelectedItem.Text = "Monitor" Or ListBox1.SelectedItem.Text = "Mouse" Then Label5.Visible = True Else Label5.Visible = False End If total = p Label5.Text = "Total: " & total End Sub Protected Sub ListBox2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged If ListBox2.SelectedItem.Text = "Monitor" Then p = 3600 total = p End If If ListBox2.SelectedItem.Text = "Mouse" Then p = 325 total = p End If

If ListBox2.SelectedItem.Text = "Monitor" Or ListBox2.SelectedItem.Text = "Mouse" Then Label5.Visible = True Else Label5.Visible = False End If total = p Label5.Text = "Total: " & total End Sub Protected Sub ddlcategory_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlcategory.SelectedIndexChanged Dim p, x, total As Integer Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged If DropDownList1.SelectedItem.Value = "Monitor" Or DropDownList1.SelectedItem.Value = "Mouse" Or DropDownList1.SelectedItem.Value = "Keyboard" Or DropDownList1.SelectedItem.Value = "System Unit" Or DropDownList1.SelectedItem.Value = "Motherboard" Or DropDownList1.SelectedItem.Value = "Speaker" Then DropDownList2.Visible = True Else DropDownList2.Visible = False End If End Sub End Sub End Class

You might also like