Você está na página 1de 6

ECOMMERCE LAB (IT-793A)

IT/4TH /BTECH/7TH SEM


Answer All Questions:
1.Design calculator in V.B and show the output?
Answer: Dim a As Single
Dim OP, flag As Integer
Private Sub DOT_Click()
If flag = 0 Then
Text1.Text = Text1.Text & "."
flag = 1
End If
End Sub
Private Sub NSQR_Click()
a = Val(Text1.Text)
Text1.Text = ""
OP = 6
End Sub
Private Sub XSQR_Click()
Text1.Text = (Val(Text1.Text)) ^ 2
End Sub
Private Sub NRT_Click()
a = Val(Text1.Text)
Text1.Text = ""
OP = 5
End Sub
Private Sub EQUAL_Click()
Select Case (OP)
Case 1:
Text1.Text = a + Val(Text1.Text)
Case 2:
Text1.Text = a - Val(Text1.Text)
Case 3:
Text1.Text = a * Val(Text1.Text)
Case 4:

Text1.Text = a / Val(Text1.Text)
Case 5:
Text1.Text = a ^ (1 / Val(Text1.Text))
Case 6:
Text1.Text = a ^ Val(Text1.Text)
End Select
End Sub
Private Sub MINUS_Click()
a = Val(Text1.Text)
Text1.Text = ""
OP = 2
End Sub
Private Sub ONE_Click()
Text1.Text = Text1.Text + "1"
End Sub
Private Sub PLUS_Click()
'a = Val(Text1.Text)
a = Val(Text1.Text)
Text1.Text = ""
OP = 1
End Sub
Private Sub SQRT_Click()
Text1.Text = Sqr(Val(Text1.Text))
End Sub
Private Sub TWO_Click()
Text1.Text = Text1.Text + "2"
End Sub
Private Sub THREE_Click()
Text1.Text = Text1.Text + "3"
End Sub
Private Sub FOUR_Click()
Text1.Text = Text1.Text + "4"
End Sub
Private Sub FIVE_Click()
Text1.Text = Text1.Text + "5"
End Sub
Private Sub SIX_Click()
Text1.Text = Text1.Text + "6"
End Sub

Private Sub SEVEN_Click()


Text1.Text = Text1.Text + "7"
End Sub
Private Sub EIGHT_Click()
Text1.Text = Text1.Text + "8"
End Sub
Private Sub NINE_Click()
Text1.Text = Text1.Text & "9"
End Sub
Private Sub ZERO_Click()
Text1.Text = Text1.Text + "0"
End Sub
Private Sub CLEAR_Click()
Text1.Text = ""
End Sub
Private Sub EXIT_Click()
End
End Sub
Private Sub FACTORIAL_Click()
Dim fact As Long, i As Integer, n As Integer
n = Val(Text1.Text)
If n < 1 Then
Beep
MsgBox ("error- try again")
Else
fact = 1
For i = 1 To n
fact = fact * i
Next i
Text1.Text = Str(fact)
End If
End Sub
Private Sub MULTIPLY_Click()
a = Val(Text1.Text)
Text1.Text = ""
OP = 3
End Sub
Private Sub DIVISION_Click()
a = Val(Text1.Text)
Text1.Text = ""
OP = 4
End Sub
2.Design a web page which consists of following fields:

First name, Last name(text box), Mrks obtained(text box), Year of passing(text box)
Select your department (combo),Password(text box),two radio buttons male and
female,One submit button and clear form is there. If we click on the submit button it will
hit on the next page congrats which consists of massages i.e: congrats U have done it
successfully
Answer:
<head>
<a href="http://www.w3schools.com/">Visit W3Schools</a>
<title>
web page</title>
<meta http-equiv="refresh"content="07"/>
</head>
<body>
<body bgcolor=cyan text=black>
<h2 style="background-color:red;">Student's database</h2>
<p><center> Fill it carefully </p></center>
<form name="LoginForm"method=post action="first.html">
First name: <input type="text"name="firstname" size="25"/></br></br>
Last name: <input type="text"name="lastname"size="25"/></br></br>
Marks obtained: <input type="text"name="marks"size="20"/></br></br></br>
Year of passing: <input type="text"name="Year"size="12"/> </br></br></br>
<p>Select Your Department </p>
<select>
<option></option>
<option>Computer Science</option>
<option> Information Technology</option>
<option> Electronics </option>
</select>
<p>
password: <input
type="text"name="pwd"value=""size="25"/></p></br></br></br>
<p><label><input type="radio"name="gender"value="male">
male</label>
<p> <label><input type="radio" name="gender"value="female">
female</label>
<p>
<input type="submit"value="submit"/>
<input type="reset"value="clear form"/>
</p>
</form>
</body>
</html>

Second source code:


<html>
<head>
<title>
web page</title>
</head>
<body>

<body bgcolor=cyan>
<h1> This is second page </h1>
<p> <center> congrts !!!! You have done it successfully</center></p>
</body>
</html>

3.Write a V.B Program consists of combo box where u can enter 10 numbers.Two
command boxes are there named as add and remove. If u click on the add buttons no to
be added in the list box and after clicking on the remove button items to be removed:
Answer:
Dim i As Integer
Dim j As Integer
Private Sub Command1_Click()
List1.List(j) = Val(Combo1.Text)
j=j+1
End Sub
Private Sub Command2_Click()
If (j = 0) Then
MsgBox ("There is no item to be delete!!!"), vbInformation, "select & remove"
Exit Sub
End If
For i = 1 To j
If (i = j And j > 0) Then
List1.RemoveItem (0)
j=j-1
Exit Sub
End If
If List1.Selected(i) = True Then
List1.RemoveItem (i)
j=j-1
Exit Sub
End If
Next
End Sub
Private Sub Form_Load()
List1.List(j) = ""
j=0
i=0
With Combo1
.AddItem 1
.AddItem 2
.AddItem 3
.AddItem 4

.AddItem 5
.AddItem 6
.AddItem 7
.AddItem 8
.AddItem 9
End With
End Sub

Você também pode gostar