-
April 16th, 2013, 03:39 PM
#1
[RESOLVED] Visual basic 6 - Next without for
Hey, this is my first post. Currently completing A2 ICT and we have a brief to code a program to allow a school worker the ability to monitor the loaning of equipment. Got an array so i can add data etc...however i need to be able to add/delete. Add works fine, the delete option keepings coming up with "next without for"?
Heres the code,
Code:
Private Sub cmddelete_Click()
Dim index As Integer
Dim numberofrecords As Integer
Dim recordnumbertodelete As Integer
Dim newfilename As String
Dim product As OneProduct
If lstdisplayfile.Text <> "" Then
recordnumbertodelete = lstdisplayfile.ListIndex + 1
End If
newfilename = App.Path & "\products.text"
Open Filename For Random As #1 Len = Len(product)
Open newfilename For Random As #2 Len = Len(product)
numberofrecords = LOF(1) / Len(product)
Get #1, , product
If index <> recordnumbetodelete Then
Put #2, , product
End If
Next index
Close #1
Close #2
Kill products
Name newfilename As products
Call displayfile
Else
MsgBox ("You must select a product first")
End If
End Sub
Cheers,
Jordie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|