program to make restaurant bill
-----------------------------------------DESIGN-----------------------------------------------------
-----------------------------------------code---------------------------------------------------------
-----------------------------------------output----------------------------------------------------
-----------------------------------------DESIGN-----------------------------------------------------
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<style>
#a1{
border-radius:25px;
background-color:Purple;
width:350px;
height:400px;
margin-left : 300;
}
</style>
<title>Restaurant Bill</title>
</head>
<body align="center"> <form id="form1" runat="server" align="center">
<div align=center> <div id="a1" > Items price<br />
<br /> <asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True" Height="227px" SelectionMode="Multiple" Width="123px">
<asp:ListItem>puff</asp:ListItem> <asp:ListItem>dabeli</asp:ListItem>
<asp:ListItem>chips</asp:ListItem>
<asp:ListItem>7up</asp:ListItem>
</asp:ListBox>
<asp:ListBox ID="ListBox2" runat="server" AutoPostBack="True" Height="227px"
SelectionMode="Multiple" Width="129px">
<asp:ListItem>rs.10</asp:ListItem> <asp:ListItem>rs.5</asp:ListItem> <asp:ListItem>rs.15</asp:ListItem>
<asp:ListItem>rs.12</asp:ListItem>
</asp:ListBox> <br /> <br /> <br /> <asp:Button ID="Button1" runat="server" Text="total bill" Width="104px" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div> </div>
</form>
</body>
</html>
-----------------------------------------code---------------------------------------------------------
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim tot As Integer = ListBox1.Items.Count
For i = 0 To tot - 1
If ListBox1.Items(i).Selected = True Then
ListBox2.Items(i).Selected = True
Else
ListBox2.Items(i).Selected = False
End If
Next
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = 0
If ListBox2.Items(0).Selected = True Then
TextBox1.Text = 10
End If
If ListBox2.Items(1).Selected = True Then
TextBox1.Text = TextBox1.Text + 5
End If
If ListBox2.Items(2).Selected = True Then
TextBox1.Text = TextBox1.Text + 15
End If
If ListBox2.Items(3).Selected = True Then
TextBox1.Text = TextBox1.Text + 12
End If
End Sub
End Class-----------------------------------------output----------------------------------------------------
![]() |
|
codestrew |
No comments:
Post a Comment