I used command buttons for Insert, Load, Save, Delete, DeleteAll and Exit. so i need help with other 5 command buttons (First,Last,Next,Previous,Edit). Also i write the info of a student in 5 textboxes each for name, surname, year, id number, grade and then when i press Insert they show in a Listbox, and when i press Load they appear in the Listbox again.
Here is the code:
Option Explicit Const max = 20 Dim p As Class1 Dim people(1 To max) As Class1 Private Sub Form_Load() End Sub Private Sub Text1_Click() Text1.Text = "" End Sub Private Sub Text2_Click() Text2.Text = "" End Sub Private Sub Text3_Click() Text3.Text = "" End Sub Private Sub Text4_Click() Text4.Text = "" End Sub Private Sub Text5_Click() Text5.Text = "" End Sub Private Sub Insert_Click() Set p = New Class1 p.studentname = Text1.Text p.studentsurname = Text2.Text p.studentyear = Text4.Text p.studentidnumber = Text3.Text p.studentgrade = Text5.Text List1.AddItem p.show Set people(List1.ListCount) = p End Sub Private Sub Load_Click() Dim ff As Long Dim line As String ff = FreeFile Open "data.txt" For Input As #ff Do While Not EOF(ff) Line Input #ff, line If Len(line) Then List1.AddItem line Loop Close #ff End Sub Private Sub Delete_Click() Dim index As Integer index = List1.ListIndex List1.RemoveItem index End Sub Private Sub Save_Click() Dim i As Integer Open "data.txt" For Output As #1 For i = 1 To List1.ListCount Write #1, people(i).studentname, people(i).studentsurname, people(i).studentyear, people(i).studentidnumber, people(i).studentgrade Next i Close (1) End Sub Private Sub DeleteAll_Click() Dim index As Integer index = List1.ListIndex List1.Clear End Sub Private Sub Exit_Click() End End Sub Public studentname As String Public studentidnumber As String Public studentsurname As String Public studentyear As String Public studentgrade As String Public Function show() As String show = studentname & " - " & studentsurname & " - " & studentyear & " - " & studentidnumber & " - " & studentgrade End Function
also i saw a post somewhere that said that VB6 is not used as much as it used to be, and is becoming a dead language. Also in my college they are going to start teaching Dotnet, does anypne know anything about this language?
This post has been edited by katsikaniaris: 09 June 2009 - 12:57 PM