Dim num As
Integer
Dim marks(10) As Integer
Private Sub CmdCreate_Click(Index As Integer)
List1.Clear
For i = 0 To 10
marks(i) = InputBox("enter marks")
List1.AddItem marks(i)
Next
End Sub
Dim marks(10) As Integer
Private Sub CmdCreate_Click(Index As Integer)
List1.Clear
For i = 0 To 10
marks(i) = InputBox("enter marks")
List1.AddItem marks(i)
Next
End Sub
Private Sub
CmdSearch_Click(Index As Integer)
num = InputBox("Enter number to be search")
For i = 0 To 10
If (num = marks(i)) Then
MsgBox "No. Found at Pos " & (i + 1)
Exit Sub
End If
Next
MsgBox "No. not Found"
End Sub
Private Sub CmdSortAsc_Click(Index As Integer)
List2.Clear
Dim temp As Integer
For i = 0 To 10
For j = i + 1 To 10
If marks(i) > marks(j) Then
temp = marks(i)
marks(i) = marks(j)
marks(j) = temp
End If
Next
Next
for i = 0 To 10
List2.AddItem marks(i)
Next
End Sub
num = InputBox("Enter number to be search")
For i = 0 To 10
If (num = marks(i)) Then
MsgBox "No. Found at Pos " & (i + 1)
Exit Sub
End If
Next
MsgBox "No. not Found"
End Sub
Private Sub CmdSortAsc_Click(Index As Integer)
List2.Clear
Dim temp As Integer
For i = 0 To 10
For j = i + 1 To 10
If marks(i) > marks(j) Then
temp = marks(i)
marks(i) = marks(j)
marks(j) = temp
End If
Next
Next
for i = 0 To 10
List2.AddItem marks(i)
Next
End Sub
Private Sub
CmdSortDesc_Click(Index As Integer)
List2.Clear
Dim temp As Integer
For i = 0 To 10
For j = i + 1 To 10
If marks(i) < marks(j) Then
temp = marks(i)
marks(i) = marks(j)
marks(j) = temp
End If
Next
Next
For i = 0 To 10
List2.AddItem marks(i)
Next
End Sub
List2.Clear
Dim temp As Integer
For i = 0 To 10
For j = i + 1 To 10
If marks(i) < marks(j) Then
temp = marks(i)
marks(i) = marks(j)
marks(j) = temp
End If
Next
Next
For i = 0 To 10
List2.AddItem marks(i)
Next
End Sub
Private Sub
CmdExit_Click(Index As Integer)
End
End Sub
End
End Sub
Output
Note:- please set some property of your control like caption
or id corresponding to your control
Goto visual basic programs index page