Mike Jonson
Add data to dataGridView
By Mike Jonson in Windows Forms on Apr 22 2011
  • Nizam Ansari
    Jun, 2012 6

    There are two ways to add data 1) By assigning an Object of Datatable/Hashtable/arraylist etc to the 'Datasource' Property of GridView 2) Or, manually add rows and values to GridView

    • 0
  • Mike Jonson
    Apr, 2011 22

    Hi!

    There is a problem: He created the following event handler:

    private void bOk_Click(object sender, EventArgs e)
            {
                DebitEnter me = new DebitEnter();

                float income;
                float.TryParse(tbSumm.Text, out income);

                me.Debit = income;
                me.DateEnter = dateTimePicker_Debit.Value;
                me.Category = tbCategory.Text;
                me.Description = textBox_Description.Text;

                //add debit in table
                fdebit.AddDebit(me);
            }

    Created a method:

    //add debit in table
    public void AddDebit(DebitEnter me)
            {
                dataGridView_Debit.Rows.Add(me.Category, me.Description, me.Debit, me.DateEnter);

            }

    But when I press the button in datagridviev nothing is added. Why can not understand? Please, help!

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS