From: Ronny on
Please excuse me if my question is not so clever....
I just learn the stuff of database and datagridview class and I have a
question. After download a sample in CodeProject.com
(http://www.codeproject.com/KB/vista/Firebird_2_and_Images.aspx) and trying
to modify some column header text I saw that the datagridview contains
column header text which I can't find in a string search, in the whole
project ( nor in the database table columns either).
Is there a way to explain that?

Regards
Ronny


From: jp2msft on
Hi Ronny,

I have not taken the time to download or install the project myself, but I
will say that calculations can be made on the fly that are displayed in a
datagrid.

Say your table contains value 10 in one row and value 5 in the next. A third
row can be added to the table that is a result of the first two: 10 / 5 = 2!

In a case like that, 2 would not in fact show up anywhere in the code,
because it is calculated on the fly.

"Ronny" wrote:

> Please excuse me if my question is not so clever....
> I just learn the stuff of database and datagridview class and I have a
> question. After download a sample in CodeProject.com
> (http://www.codeproject.com/KB/vista/Firebird_2_and_Images.aspx) and trying
> to modify some column header text I saw that the datagridview contains
> column header text which I can't find in a string search, in the whole
> project ( nor in the database table columns either).
> Is there a way to explain that?
>
> Regards
> Ronny
>
>
>
From: Ciaran O''Donnell on
Try this:

//Add the first column
DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn();
col.HeaderText = "Name";
col.ValueType = typeof(String);
dataGridView1.Columns.Add(col);
//Add the second column
col = new DataGridViewTextBoxColumn();
col.HeaderText = "Id";
col.ValueType = typeof(int);
dataGridView1.Columns.Add(col);
//Add the third column
col = new DataGridViewTextBoxColumn();
col.HeaderText = "Id";
col.ValueType = typeof(int);
dataGridView1.Columns.Add(col);

//add the data
dataGridView1.Rows.Add("ABC", 123, 300);

//auto size the columns to make them pretty
dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);


--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com


"Claudia Fong" wrote:

>
> I need to add new rows into a datagridview manually.. but when I first
> added the new row I got an error of:
> No row can be added to a DataGridView control that does not have
> columns. Columns must be added first.
>
> But when I add the column I got this error:
>
> At least one of the DataGridView control's columns has no cell template.
>
> Can someone help me?
>
> I want to add something like this:
>
> Name Id Balance
> ABC 123 300
>
>
> Cheers!
>
> Claudi
>
> *** Sent via Developersdex http://www.developersdex.com ***
>
From: Ciaran O''Donnell on
What you have written makes absolutely no sense at all.
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com


"raylopez99" wrote:

> On Jul 17, 5:36 am, Claudia Fong <cdolphi...(a)yahoo.co.uk> wrote:
> > I need to add new rows into a datagridview manually.. but when I first
> > added the new row I got an error of:
> > No row can be added to a DataGridView control that does not have
> > columns. Columns must be added first.
> >
> > But when I add the column I got this error:
> >
> > At least one of the DataGridView control's columns has no cell template.
> >
> > Can someone help me?
> >
> > I want to add something like this:
> >
> > Name Id Balance
> > ABC 123 300
> >
> > Cheers!
> >
> > Claudi
> >
> > *** Sent via Developersdexhttp://www.developersdex.com***
>
> I don't know what you mean by 'manually'? You mean by hand, or by
> code?
>
> If by code or by hand, just start from scratch. Somewhere you have a
> self-referential pointer that points back to itself and throws you for
> a loop. Stuff is binding to stuff that is also trying to bind and you
> have this back and forth situation--pardon my scientific language.
>
> My two cents, for what it's worth.
>
> RL
>