[Request] Selected Item in listbox

11/22/2008 05:56 GrandSlam#1
Ok so i've been working on my own Admin panel for a LOTF source and been working on the disconnect from a listbox option.

Code:
            foreach (DictionaryEntry DE in World.AllChars)
            {
                Character Charr = (Character)DE.Value;
                if (Charr.MyClient.Online)
                {
                    listBox1.SelectedItem = listBox1.SelectedItem;
                    Charr.MyClient.Drop();
                    return;
                }
            }
that is for the disconnect button

only problem is that even you select a different character it disconnects the very first one

im guessing it has to do with looking for the number if items in the listbox and then clicking it and disconnecting that client corresponding to the object number
11/22/2008 06:23 © Haydz#2
Quote:
Originally Posted by GrandSlam View Post
Ok so i've been working on my own Admin panel for a LOTF source and been working on the disconnect from a listbox option.

Code:
            foreach (DictionaryEntry DE in World.AllChars)
            {
                Character Charr = (Character)DE.Value;
                if (Charr.MyClient.Online)
                {
                    listBox1.SelectedItem = listBox1.SelectedItem;
                    Charr.MyClient.Drop();
                    return;
                }
            }
that is for the disconnect button

only problem is that even you select a different character it disconnects the very first one

im guessing it has to do with looking for the number if items in the listbox and then clicking it and disconnecting that client corresponding to the object number
i lol'd...

All thats doing is disconnect every client
if your listbox is in format of the clients name you need to do this:

Code:
            foreach (DictionaryEntry DE in World.AllChars)
            {
                Character Charr = (Character)DE.Value;
                if (Charr.MyClient.Online && Charr.Name == listBox1.SelectedItem.ToString())
                {
                    Charr.MyClient.Drop();
                    return;
                }
            }
Or something like that, its 5 am excuse me if that fails
11/22/2008 08:06 turk55#3
maybe this should work if you delete: Charr.MyClient.Drop();

cuz Drop(); is also for dcing in game so ya :D
11/22/2008 08:49 alexbigfoot#4
Quote:
Originally Posted by turk55 View Post
maybe this should work if you delete: Charr.MyClient.Drop();

cuz Drop(); is also for dcing in game so ya :D
lol`d?, rotfl , using Charr.MyClient.Drop(); , it disconect the selected char from World.AllChars , kinda
if(Char.Name == "learnsomething")
{
Char.MyClient.Drop();
}
else
Console.WriteLine("GO Learn MORE!");
11/22/2008 15:34 turk55#5
Quote:
Originally Posted by alexbigfoot View Post
lol`d?, rotfl , using Charr.MyClient.Drop(); , it disconect the selected char from World.AllChars , kinda
if(Char.Name == "learnsomething)
{
Char.MyClient.Drop();
}
else
Console.WriteLine("GO Learn MORE!");

LOL ? dude im just like a week or 2 busy with it so dont flame at me!:mad::mad:
11/22/2008 16:26 alexbigfoot#6
yea, i know ur new here, but still i know that u, want to make a server , without knowing stuff like this , to dc only the selected item ,try to understand Haydz`s code from...........^
.................................................. .................................................. .....|
11/22/2008 16:29 © Haydz#7
Can you screeny your listbox for me? :o