I am well and truly stumped. I am working on a server database program for my advanced higher computing project and I've got everything done except my last feature. I'd like users to be able to select a server from a combobox (Done) and then have the program delete that server from the combobox (Also done!) and then rewrite the array, without the deleted server, back to the external file. I'm not totally sure what the best way to go about this is going to be. So far I've been trying to rewrite the contents of the combobox back into the array and then onto the file, but it appears each item within the combobox list is written as an individual string, rather than each field being stored separately. This would appear to be the easiest way to implement it, but as far as I am aware not possible. So the second method I've gone for is as follows. Code: Private Sub cmdDelete_Click() Dim SelectedServer As Integer SelectedServer = cmboServers.ListIndex 'Sets the selected server as the one selected in the combobox For Index = 0 To TotalNumberofServers If Index = ServerDetails(SelectedServer).ServerIndex Then '.Serverindex is the field which assigns a number to each record. This changes if the list is sorted Index = Index + 1 End If ServerDetails(Index).IP = ServerDetails(Index).IP ServerDetails(Index).Name = ServerDetails(Index).Name ServerDetails(Index).Game = ServerDetails(Index).Game ServerDetails(Index).Map = ServerDetails(Index).Map Next Index TotalNumberofServers = TotalNumberofServers - 1 Call SaveFile frmDisplayData.Show frmDelete.Hide End Sub The problem with this is that every time I go to delete an item, it just deletes the last item in the list. What am I doing wrong? Regards, Jack
VB6.0 isn't something I've done recently, so forgive me if this isn't relevant. I'd usually do this in a loop to exclude the one I don't want: Code: for $val = 0 to $total { if (this is the selected item) { // Do nothing as this shouldn't be written to the file } else { // We want this line, so prepare it to be written to the file } } This is, IMO, a better way of ensuring the details you don't want are excluded, while the rest are processed. This is my attempt to VB it, you'd prolly need to fix it, as I'm a PHP kiddie these days. Code: Private Sub cmdDelete_Click() Dim SelectedServer As Integer SelectedServer = cmboServers.ListIndex 'Sets the selected server as the one selected in the combobox For Index = 0 To TotalNumberofServers If Index = ServerDetails(SelectedServer).ServerIndex Then ' Don't do anything Else ServerDetails(Index).IP = ServerDetails(Index).IP ServerDetails(Index).Name = ServerDetails(Index).Name ServerDetails(Index).Game = ServerDetails(Index).Game ServerDetails(Index).Map = ServerDetails(Index).Map End If Next Index TotalNumberofServers = TotalNumberofServers - 1 Call SaveFile frmDisplayData.Show frmDelete.Hide End Sub