Visual Basic - How do I make a Panel that is not visible when the program runs become visible when a DropDownList selects an item.
The first item on the list should be "Select Option" which leaves the Panel as not visible. The second item should be "North" and when it is selected, the Panel should appear and a Label on the Panel should say "North Location". The third item should be "South" and when it is selected, the Panel should appear as well and the Label should say "South Location.
I have tried the code below and it does not make the panel appear.
Protected Sub DropDownList1_SelectedIndexChanged1(sender As
Object, e As EventArgs) Handles
DropDownList1.SelectedIndexChanged
Panel1.Visible = True
NOR
If DropDownList1.SelectedIndex = 1 Then
Panel1.Visible=True
End If
End Sub
Dear Student ,
As per requirement submitted above kindly find below solution.
Here new asp,net web application in VB is created using visual studio 2019 with name "WebApplication1". This application contains a web form with name "WebForm1.aspx".Below is the details of this web form.
NOTE :Hre AutoPostBack property for dropdown is need to set as true.
WebForm1.aspx :
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server"
AutoPostBack="True">
<asp:ListItem>Select Option</asp:ListItem>
<asp:ListItem>North</asp:ListItem>
<asp:ListItem>South</asp:ListItem>
</asp:DropDownList>
<br />
<br />
</div>
<asp:Panel ID="Panel1" runat="server" Visible="False">
<asp:Label ID="lblHeader"
runat="server"></asp:Label>
</asp:Panel>
</form>
</body>
</html>
************************************
WebForm1.aspx.cs :
Public Class WebForm1 'VB Class
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
'DropDownList1 selected index changed
Protected Sub DropDownList1_SelectedIndexChanged(sender As Object,
e As EventArgs) Handles DropDownList1.SelectedIndexChanged
'checking which index is selected
If DropDownList1.SelectedIndex = 1 Then
Panel1.Visible = True 'make panel visible
lblHeader.Text = "North Location" 'set text to the label
ElseIf DropDownList1.SelectedIndex = 2 Then
Panel1.Visible = True 'make panel visible
lblHeader.Text = "South Location" 'set text to the label
Else
Panel1.Visible = False 'do not show the panel
lblHeader.Text = "" 'set empty text to the label
End If
End Sub
End Class
==================================
Output :Run application using F5 and will get the screen as shown below
Screen 1:WebForm1.aspx

Screen 2:WebForm1.aspx, screen when North is selected

Screen 3:WebForm1.aspx, screen when South is selected

NOTE :PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
Visual Basic - How do I make a Panel that is not visible when the program...
I need help with this problem in Visual Basic 2012: Write a program that allows the user to specify two numbers and then adds, subtracts, multiplies, or divides them when the user clicks on the appropriate button. The output should give the type of arithmetic performed and the result. Whenever one of the numbers in an input text box is changed, the output text box should be cleared. Also, if the number 0 is entered into the second text box,...
Program using visual basic.net You will create a very simple two numbers calculator with save options; here is the specifications for the application. Create a form divided vertically in two halves with right and left panels 1- In the left panel you will create the following control, the label or the value of the control will be in "" and the type of the control will in [] a- "First Number" [textbox] b- "Second number" [texbox] c- "Result" [textbox] -...
I really need some help fixing a code error in Visual Basic I was wondering if anyone could help fix the error that I'm about to provide in bold thanks so much! I'll also tell what the error is. Public Class MainForm Private Sub exitButton_Click(sender As Object, e As EventArgs) Handles exitButton.Click Me.Close() End Sub Dim img As Image = Image.FromFile("C:\Users\Pranesh\Pictures\11599264.jpg") house1PictureBox.Image = img house2PictureBox.Image = img house3PictureBox.Image = img house4PictureBox.Image = img house1PictureBox.Visible = False house2PictureBox.Visible = False house3PictureBox.Visible...
Project 10-1 Convert lengths In this assignment, you’ll add code to a form that converts the value the user enters based on the selected conversion type. The application should handle the following conversions: From To Conversion Miles - Kilometers: 1 mile = 1.6093 kilometers Kilometers - Miles: 1 kilometer = 0.6214 miles Feet - Meters: 1 foot = 0.3048 meters Meters - Feet: 1 meter = 3.2808 feet Inches - Centimeters: 1 inch = 2.54 centimeters Centimeters - Inches: 1...
This is done in visual basic langauge. I created a
query and i want to invoke this query from code.
for example, if i select the Company-owned radio button and hit the
display button ONLY the information for company owned stores should
be shown. same for the other radio button except it will only show
the information for the Franchise ownership.
F. for Franchises
C. for company owned
please provide the appropriate code.
and select statements.
hon Mcescft Vsal Studio...
I am trying to build a program in Visual Basic that allows user
to enter an objects mass and velocity and to display the Kinetic
energy. The application should have a function KineticEnergy that
accepts a moving objects mass and velocity as arguments. The
function should return the objects KE.
i get these three errors when trying to run the program I need
help how would I fix this so it runs successfully? Thanks in
advance!
Start 16 ml.vb* +...
Visual Basic 2015: Extra 18-1 Use inheritance with the Inventory
Maintenance Application
Source Code:
1. frmNewItem.vb
Public Class frmNewItem
Public InvItem As InvItem
Private Sub frmNewItem_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
Me.LoadComboBox()
End Sub
Private Sub LoadComboBox()
cboSizeOrManufacturer.Items.Clear()
If rdoPlant.Checked Then
cboSizeOrManufacturer.Items.Add("1 gallon")
cboSizeOrManufacturer.Items.Add("5 gallon")
cboSizeOrManufacturer.Items.Add("15 gallon")
cboSizeOrManufacturer.Items.Add("24-inch box")
cboSizeOrManufacturer.Items.Add("36-inch box")
Else
cboSizeOrManufacturer.Items.Add("Bayer")
cboSizeOrManufacturer.Items.Add("Jobe's")
cboSizeOrManufacturer.Items.Add("Ortho")
cboSizeOrManufacturer.Items.Add("Roundup")
cboSizeOrManufacturer.Items.Add("Scotts")
End If
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs)
Handles btnSave.Click
If IsValidData() Then
InvItem = New InvItem(CInt(txtItemNo.Text),...
Visual Basic: Create an application that simulates a tic tac toe game. The form uses 9 large labels to display the x's and o's. The application should use a two dimensional integer array to simulate the game board in memory. When the user clicks the "New Game" button the application should step throguh the array storing a random number of 0 to 1 in each element. The numer 0 represent the letter o and the number 1 reprsents the letter...
computer Programming
visual Basic
1-10
QUESTION 1 Which of the following is not a logical operator in Visual Basic? Not • or And Then QUESTION 2 Which of the following is a valid Visual Basic conditional statement? 2<n<5 2 <n or <5 0 2 <n<5 (2 <n) or (n <5) QUESTION 3 When Visual Basic stops evaluating a compound condition with the logical And operator because the first condition evaluates to False. It is called evaluation. short-circuit Pre- compound first...
The questions below deal with Microsoft Visual Studio 2012
Reloaded, under the Visual Basic programming language. The book
ISBN number that I am using is: 978-1-285-08416-9 or the UPC code
is: 2-901285084168-1.
Question 1
Visual Basic 2012 is an object-oriented programming language,
which is a language that allows the programmer to use
____________________ to accomplish a program�s goal.
Question 2
An application that has a Web user interface and runs on a
server is called a(n) ____________________ application.
Question 3...