views:

73

answers:

2

I want to display 2 sets of data on the one list box, for example, I would wont to display the 7 times table and the 8 times table on the same listbox. Here is how I get the first set of data displaying:

            int awnser = 0;
        int z;
        z = int.Parse(textBox1.Text);

        for (int i = 0; i < 11; i++)
        {
            awnser = z * i;

            listBox6.Items.Add(z + " * " + i + " = " + awnser.ToString());
        } 

But how do I get a line break or separation so I can put the 8 times table just underneath?

+2  A: 

How about this?

EDIT Insert it AFTER your loop

        listBox6.Items.Add(z + " * " + i + " = " + awnser.ToString());
    } 

listBox6.Items.Add("--------------------");
Benjol
Yup, or just .Add("")
Hans Passant
it doesnt work for me
Codie Vincent
it doesnt the first of both calculations then has the line break, i need all the 7 time tables, line break, then all the 8s, atm it gives me the 7x1 and 8x1 the line break, 7x2 and 8x2 the line break and so on.
Codie Vincent
A: 

In WPF this is easy to do using a custom template, but in WinForms I think you must do it by rendering the list items yourself.

Look at this example where they override the OnDrawItem method: http://www.syncfusion.com/FAQ/windowsforms/faq_c87c.aspx#q627q

Rune Grimstad