C Amr Moneim C Amr Moneim - 1 year ago 93
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;




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 Source
            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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download