Új hozzászólás Aktív témák

  • Neil Watts

    veterán

    Sziasztok!

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace tobbVektorBeszurTorol
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }
    string[] Benevek = new string[] {"Hack Elek"};

    string[] BeAzon = new string[] {"HackE"};

    string[] Nevek = new string[50];
    string[] Azon = new string[50];

    int elemszam = 0;
    //int elemszam_Azon = 0;

    private void buttonBeolvas_Click(object sender, EventArgs e)
    {
    for (int i = 0; i < elemszam; i++)
    {
    Nevek[elemszam] = Benevek[i];
    Azon[elemszam] = BeAzon[i];
    elemszam++;
    }
    buttonLista.Enabled = true;
    }

    private void buttonLista_Click(object sender, EventArgs e)
    {
    dataGridViewLista.RowCount = elemszam;
    dataGridViewLista.ColumnCount = 3;

    dataGridViewLista.RowHeadersWidth = 150;

    dataGridViewLista.Columns[0].HeaderCell.Value = "Név";
    dataGridViewLista.Columns[0].Width = 200;

    dataGridViewLista.Columns[1].HeaderCell.Value = "Felhasználónév";
    dataGridViewLista.Columns[1].Width = 200;

    dataGridViewLista.Columns[2].HeaderCell.Value = "Rendelési azonosító";
    dataGridViewLista.Columns[2].Width = 200;

    for (int i = 0; i < elemszam; i++)
    {
    dataGridViewLista.Rows[i].HeaderCell.Value = (i + 1).ToString() + ". fehasználó";
    }
    }
    }
    }

    Ennek meg mi baja lehet? A dataGridViewLista.RowCount = elemszam; sornál akad ki, csak azt nem tudom, hogy mi a francért. Azt írja, hogy az elemszam 0.

    "Value of '0' is not valid for 'RowCount'. 'RowCount' must be greater than or equal to 1.
    Parameter name: RowCount"

    De miért? Hiszen folyamatosan növelem, úgy hogy jó legyen... eh :(

    Üdv. core2

Új hozzászólás Aktív témák

Hirdetés