Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I try to get value int i and j in listbox, but then this error come out
No overload for method 'Add' takes 2 arguments. Can somebody help me please. I've been stuck at this error almost 2 days..

What I have tried:

private void Form10_Load(object sender, System.EventArgs e)
        {
            int i;
            int j;

            for (i = 1; i <= Form9.Npmax; i++)
            {
                for (j = Form9.Nsmin_mp; j <= Form9.Nsmax_oc; j++)
                {

                    listBox1.Items.Add(i.ToString(),j.ToString());

                }
            }
        }
Posted
Updated 12-May-18 7:25am
v2

1 solution

You could do it like this:
listBox1.Items.Add(i + " " + j);
If you need real columns, then use a ListView, see example here: .net - Populating a listview multi-column - Stack Overflow[^]
 
Share this answer
 
v2
Comments
Afzaal Ahmad Zeeshan 12-May-18 14:03pm    
5ed.
Member 13318869 13-May-18 0:07am    
it works! thanks a lot Rick!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900