user1874271
user1874271

Reputation: 11

adding to listboxes. I keep getting an error under the Items in tabPage1.Items.Add

Error 1 'System.Windows.Forms.TabPage' does not contain a definition for 'Items' and no extension method 'Items' accepting a first argument of type 'System.Windows.Forms.TabPage' could be found (are you missing a using directive or an assembly reference?)

private void btnReadandPrint_Click(object sender, EventArgs e)
    {
        reader = new StreamReader(openFileDialog1.FileName);

        ResetFile();

        do
        {
            s += reader.ReadLine() + "";
            counter++;

            if (counter % 5 == 0)
            {
                tabPage1.Items.Add("Line" + counter + ":" + s);
                s = "";
            }
        } while (!reader.EndOfStream);
    }

Upvotes: 1

Views: 112

Answers (1)

TinyPinkSaxophone
TinyPinkSaxophone

Reputation: 130

TabPage is not a ListBox. Add a listbox to the page and add items to that.

Upvotes: 3

Related Questions