jorge Posted October 19, 2003 Posted October 19, 2003 Here is the code, and my apps crashes after it is done! Dim sServerFav_new As String Dim serverfav_rm As String serverfav_rm = lbfavserver.SelectedItem Dim i For i = 0 To lbfavserver.Items.Count lbfavserver.SelectedIndex = i If lbfavserver.SelectedItem <> serverfav_rm Then sServerFav_new = sServerFav_new + lbfavserver.SelectedItem + "|" End If Next i MsgBox(sServerFav_new) Quote Jorge - http://www.blackdot.be/?page=apache.htm
*Experts* Volte Posted October 19, 2003 *Experts* Posted October 19, 2003 Doesn't seem like it should -- is there anything after that sub? In what context is that code used? Quote
jorge Posted October 19, 2003 Author Posted October 19, 2003 i'm added a lisbox with keep ip addresses, and a add and remove button and this code is for the remove button so it remove the selectet item and recoposes the string to save in the regestry, and there is nothing after this acepte end sub here is the code fot both buttons: Private Sub cmdaddserver_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdaddserver.Click Dim sServerFav_new As String Dim serverfav_Add As String serverfav_Add = InputBox("Ip Adress", "Add Server") sServerFav_new = sServerFav + serverfav_Add + "|" SaveSetting("ApacheMon", "Settings", "sServerFav", sServerFav_new) sServerFav = sServerFav_new serverfav_reload() End Sub Private Sub cmdrmserver_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdrmserver.Click Dim sServerFav_new As String Dim serverfav_rm As String serverfav_rm = lbfavserver.SelectedItem Dim i For i = 0 To lbfavserver.Items.Count lbfavserver.SelectedIndex = i If lbfavserver.SelectedItem <> serverfav_rm Then sServerFav_new = sServerFav_new + lbfavserver.SelectedItem + "|" End If Next i MsgBox(sServerFav_new) End Sub Quote Jorge - http://www.blackdot.be/?page=apache.htm
Leaders dynamic_sysop Posted October 19, 2003 Leaders Posted October 19, 2003 have you tried adding - 1 at the end of lbfavserver.Items.Count ? eg: For i = 0 To lbfavserver.Items.Count - 1 '/// do stuff Next Quote
*Experts* Volte Posted October 19, 2003 *Experts* Posted October 19, 2003 Ah yes, that will do it. For some reason I was under the impression it was just closing without an error message (I guess because he said the application "terminates" -- I've been subclassing VB6 too much I guess :p). :o Quote
jorge Posted October 19, 2003 Author Posted October 19, 2003 ok the -1 works, thanx Quote Jorge - http://www.blackdot.be/?page=apache.htm
jorge Posted October 19, 2003 Author Posted October 19, 2003 Ok it still seem a bit buggy, when there are 2x the same item it still craches, and frmmain.lbfavserver.items.clear() doen't work Quote Jorge - http://www.blackdot.be/?page=apache.htm
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.