C Amr Moneim C Amr Moneim - 2 months ago 8
C# Question

How to select 1 row with 2 items from Listbox to use them in method

I want to select 1 row with 2 items from listbox to use them in method

here I add 2 items in 1 row

Uniqueslist.Items.Add(string.Format("{0} , {1}", MobIDTextUnq.Text, MobCntTextUnq.Text));


And I want to use this 2 items in this method

public static void Loadmonster(int MobID,int Cont)
{
DateTime time = System.DateTime.Now;
time.ToLongTimeString();

try
{


packet.WriteUInt32(MobID);
packet.WriteUInt8(Cont);

}
}


I think it's by loop but I don't know how to do this and I want if this like example 1 row selected never select it again and select the next row and never back again i hope someone help me with this problem .

Answer
            var GetItem = UnqEventWindow.Uniqueslist.Items[i];
            var MakeItem = GetItem.ToString().Split(',');

            int MobID = int.Parse(MakeItem[0].Trim());
            int Count = int.Parse(MakeItem[1].Trim());

            myclass.Loadmonster(MobID, Count);
Comments