Freshman vb the division of the final big homework
The number, age and the popularity of sorting, sequencing respectively
Public Class infolist
Dim lastrecord As Integer
Dim carray (,) As String
Private Sub frmdisplay_Deactivate (ByVal sender As Object, ByVal e the As System. EventArgs) Handles Me. Deactivate
FileClose (1)
End Sub
Private Sub frmdisplay_Activated (ByVal sender As Object, ByVal e the As System. EventArgs) Handles Me. Activated
Dim As Integer I
FileOpen (1, Application StartupPath & amp; "\ regist. TXT",
OpenMode. Random,,, Len (parti))
Lastrecord=LOF (1)/Len (parti)
Infolist. Items. The Clear ()
Infolist. Items. Add (" number "& amp; Space (7) & amp; "Name" & amp; Space (7) & amp; "Gender" & amp; Space (5) & amp; "Age" & amp; Space (7) & amp; "Sentiment" & amp; Space (7) & amp; "Professional")
For I=1 To lastrecord
FileGet (1, parti, I)
Infolist. Items. The Add (parti. No & amp; Space (11 - Len (parti. No)) & amp; Parti, name & amp; Space (11 - Len (parti. Name)) & amp; Parti. Sex & amp; Space (11 - Len (parti. Sex)) & amp; Parti, age & amp; Space (11 - Len (parti. Age)) & amp; Parti. Vote & amp; Space (11 - Len (parti. Vote)) & amp; Parti. Major)
Infolist. Items. The Add (parti. No & amp; Parti, name & amp; Parti. Sex & amp; Parti, age & amp; Parti. Vote & amp; Parti. Major)
Next I
End Sub
Private Sub cmdsortno_Click (ByVal sender As Object, ByVal e the As System. EventArgs) Handles cmdsortno. Click
Dim n As Integer
'Dim number (n, 1) As Single
N=LOF (1)/Len (parti)
If n=0 Then
MsgBox (" no students in the file ")
The Else
ReDim carray (n 5)
Call to readdata (carray, n)
Call sortdata (carray, n, 0)
Call showdata (carray, n)
End the If
End Sub
Private Sub cmdsortvote_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles cmdsortvote. Click
Dim n As Integer
N=LOF (1)/Len (parti)
If n=0 Then
MsgBox (" no students in the file ")
The Else
ReDim Preserve carray (n 5)
Call to readdata (carray, n)
Call sortdata (carray, n, 0)
Call showdata (carray, n)
End the If
End Sub
Private Shared Function items () As the Object
Throw New NotImplementedException
End the Function
Private Sub cmdsortage_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles cmdsortage. Click
Dim n As Integer
N=LOF (1)/Len (parti)
If n=0 Then
MsgBox (" no student in the file ")
The Else
ReDim carray (n 5)
Call to readdata (carray, n)
Call sortdata (carray, n, 3)
Call showdata (carray, n)
End the If
End Sub
Private Sub cmdback_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles cmdback. Click
Form3. Hide ()
Form2. The show ()
End Sub
Private Sub ListBox1_Click (ByVal sender As Object, ByVal e the As System. EventArgs) Handles ListBox1. Click
ListBox1. Text=""
Dim STR As String
FileOpen (1, "C: \ Users \ lenovo \ Desktop \ VB \ Windows \ \ form's information", OpenMode. Input)
The Do While Not EOF (1)
STR=LineInput (1)
ListBox1. Text=ListBox1. Text + STR + vbCrLf
Loop
End Sub
The End of the Class
CodePudding user response:
Homework......