Option Explicit Private Sub cbotitle_Change() Dim intbook As Integer, strtitle As String, strauthor As String, intstock As Integer Open "Books.txt" For Input As #intbookfile Do While Not EOF(intbook) Input #intbook, strtitle, strauthor, intstock If strtitle = cbotitle.Text Then txtauthor.Text = strauthor txtstock.Text = intstock End If Loop Close #intbook End Sub Private Sub cmdbook_Click(Index As Integer) Dim intbook As Integer, intnewbook As Integer, strtitle As String, strauthor As String, intstock As Integer If cbotitle.Text <> "" Then intbook = FreeFile Open "Books.txt" For Input As #intbook intnewbook = FreeFile Open "Tempbooks.txt" For Output As #intnewbook Do While Not EOF(intbook) Input #intbook, strtitle, strauthor, intstock If Index = 0 Then If strtitle = cbotitle.Text Then intstock = txtstock.Text End If Write #intnewbook, strtitle, strauthor, intstock ElseIf Index = -1 Then If Not strtitle = cbotitle.Text Then Write #intnewbook, strtitle, strauthor, intstock End If End If Loop Close #intbook Close #intnewbook Kill "Books.txt" Name "Tempbooks.txt" As "Books.txt" Call Refreshinterface End If End Sub Sub Refreshinterface() Dim intbook As Integer, strtitle As String, strauthor As String, intstock As Integer txtauthor.Text = "" txtstock.Text = "" intbook = FreeFile Open "Books.txt" For Input As #intbook cbotitle.Clear Do While Not EOF(intbook) Input #intbook, strtitle, strauthor, intstock cbotitle.AddItem strtitle Loop Close #intbook End Sub Private Sub cmddone_Click() End End Sub Private Sub Form_Load() Call Refreshinterface End Sub