Vb.net Code:-
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim a As Single
Dim b As Single
Dim c As Single
Dim inch As Single
Dim yard As Single
Dim meter As Single
Dim fathom As Single
Dim rod As Single
Dim furlong As Single
Dim kilometer As Single
Dim mile As Single
Dim foot As Single
yard = 3
meter = 3.28155
fathom = 6
rod = 16.5
furlong = 660
kilometer = 32815
mile = 5280
If Val(TextBox1.Text) = 1 Then
a = inch
End If
If TextBox1.Text = 2 Then
a = yard
End If
If TextBox1.Text = 3 Then
a = meter
End If
If TextBox1.Text = 4 Then
a = fathom
End If
If TextBox1.Text = 5 Then
a = rod
End If
If TextBox1.Text = 6 Then
a = furlong
End If
If TextBox1.Text = 7 Then
a = kilometer
End If
If TextBox1.Text = 8 Then
a = mile
End If
If Val(TextBox2.Text) = 1 Then
b = inch
End If
If TextBox2.Text = 2 Then
b = yard
End If
If TextBox2.Text = 3 Then
b = meter
End If
If TextBox2.Text = 4 Then
b = fathom
End If
If TextBox2.Text = 5 Then
b = rod
End If
If TextBox2.Text = 6 Then
b = furlong
End If
If TextBox2.Text = 7 Then
b = kilometer
End If
If TextBox2.Text = 8 Then
b = mile
End If
c = Val(TextBox3.Text) * a
Dim ans As Integer
ans = c / b
TextBox4.Text = ans
End Sub
End Class
Form:-
HTML CODE:-
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication3.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" Text="Convert"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Height="16px"></asp:TextBox>
<asp:ListBox ID="ListBox1" runat="server" Height="163px" Width="116px">
<asp:ListItem Value="1">1-inch</asp:ListItem>
<asp:ListItem>2-Yard</asp:ListItem>
<asp:ListItem>3-Meter</asp:ListItem>
<asp:ListItem>4-Fathom</asp:ListItem>
<asp:ListItem>5-Rod</asp:ListItem>
<asp:ListItem>6-Furlong</asp:ListItem>
<asp:ListItem>7-KiloMeter</asp:ListItem>
<asp:ListItem>8-Mile</asp:ListItem>
<asp:ListItem>9-Foot</asp:ListItem>
</asp:ListBox>
Select no according to that table in text boxes<p>
<asp:Label ID="Label2" runat="server" Text="Converted To "></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</p>
<p>
<asp:Label ID="Label3" runat="server" Text="Qunatity"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</p>
<p>
<asp:Button ID="Button1" runat="server" OnClientClick="Onadd()" style="margin-left: 0px" Text="Convert Now" />
</p>
Result <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</form>
</body>
</html>
0 comments:
Post a Comment