deathman5
09-29-2004, 10:38 AM
Im working on an IRC program, Im trying now to save the servers, so the user wont have to remember them all
I have a list box, I put inside it the server names that are saved using this code
Text1 = Server
Text2 = Port
Dim Ser(2500) As String
Dim Por(2500) As String
Dim TotalWords As Integer
Private Sub Command6_Click()
'How To Save
Ser(TotalWords) = Text1.Text
Por(TotalWords) = Text2.Text
Open "Servers.dat" For Append As #1
Write #1, Ser(TotalWords), Por(TotalWords)
Close
TotalWords = TotalWords + 1
'How To Load
List1.Clear
TotalWords = 0
Open "Servers.dat" For Input As #1
Do Until EOF(1) = True
Input #1, Ser(TotalWords), Por(TotalWords)
TotalWords = TotalWords + 1
Loop
Close
Dim x As Integer
For x = 0 To TotalWords - 1
List1.AddItem Ser(x)
DoEvents
Next x
End Sub
Ok the problem is, I want to make the user able to remove some servers by highlighting them on the list and clicking command button, but then I have to remove them from the file it self and I must not keep any blank lines or spaces in the file (need that for another thing)
So how to do that?
I have a list box, I put inside it the server names that are saved using this code
Text1 = Server
Text2 = Port
Dim Ser(2500) As String
Dim Por(2500) As String
Dim TotalWords As Integer
Private Sub Command6_Click()
'How To Save
Ser(TotalWords) = Text1.Text
Por(TotalWords) = Text2.Text
Open "Servers.dat" For Append As #1
Write #1, Ser(TotalWords), Por(TotalWords)
Close
TotalWords = TotalWords + 1
'How To Load
List1.Clear
TotalWords = 0
Open "Servers.dat" For Input As #1
Do Until EOF(1) = True
Input #1, Ser(TotalWords), Por(TotalWords)
TotalWords = TotalWords + 1
Loop
Close
Dim x As Integer
For x = 0 To TotalWords - 1
List1.AddItem Ser(x)
DoEvents
Next x
End Sub
Ok the problem is, I want to make the user able to remove some servers by highlighting them on the list and clicking command button, but then I have to remove them from the file it self and I must not keep any blank lines or spaces in the file (need that for another thing)
So how to do that?