Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
When my program starts, there is a listbox with 43 names in it. When user clicks on a name, variable CurNum is remembered(CurNum = List1.ListIndex + 1), form2 loads, and opens a raf to CurNum record, and user can fill info about person into textboxes and save the info,So far so good.
Now here's my problem, say :CurNum 30=Mike, New York
CurNum 31=Doug, Florida
CurNum 32=Steve, Indiana
CurNum 33=Joey, OhioAnd 31 Doug didn't send me a Valentine's Day card, so I want to delete him.(LOL)
Now 31 Doug deletes okay, but afterwards
32 becomes blank and 33 becomes Indiana, 34 becomes Ohio, all down the list. And I can't see my mistake.
Any ideas appreciatedPublic Sub DeleteMemberFromAddyInfo()
Dim DirResult
Dim tmpAddyFileNum As Integer
Dim tmpAddy As AddressList
Dim tmpAddyListLen As Long
''''''''''''''''''''''''''''''''
If Dir("AddyInfo.TMP") = "AddyInfo.TMP" Then
Kill "AddyInfo.TMP"
End If
''calculate length of record
tmpAddyListLen = Len(tmpAddy)
''create tmp file
tmpAddyFileNum = FreeFile
Open gPath & "AddyInfo.TMP" For Random As tmpAddyFileNum Len = tmpAddyListLen
''what record are we at?
''curnum...so.....
''how many recs in ginfo?
gAddressListLen = Len(gInfo)
Dim TotalOld
TotalOld = FileLen(gPath & "AddyInfo.DAT") /
gAddressListLen
Dim times
For times = 1 To TotalOld
If times <> CurNum Then
Get #gAddyFileNumber, times, gInfo
Put #tmpAddyFileNum, times, gInfo
End If
Next times
Close
Kill gPath & "AddyInfo.DAT"
Name gPath & "AddyInfo.TMP" As gPath & "AddyInfo.DAT"End Sub
Thanks, Jessica

wow, I suggest using either a database file (such as access) or an XML file that way you don't have to do what you are doing (making a temp file and then moving names into dat file).
Or, you could simply use a collection class that you could simply save to the disk whenever something changes in it.
Chi
They mostly come at night...mostly.

![]() |
Need Solution for accessi...
|
Cannot install VB Express...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |