Re: How do I populate a DataGridView with arrays containing strings? (I get convertion error C2664)
- From: "Fleemox" <garanteratspam@xxxxxxxx>
- Date: 18 Feb 2007 13:03:44 -0800
Joseph M. Newcomer wrote:
So what is the specified argument to the method in question? You seem to be assuming it
can be a 'string' data type, when in fact it is probably something else.
Yes, maybe it can't be a 'string' data type. I just thought that I
could throw in whatever data or datacontaining thing inside the
parenthesis of the Add() function and then get it to show up in the
grid, but that is probably not how it works.
Also, why do you
need to keep the row text if it is in the grid, and why is 8000 considered a meaningful
number?
The main task for the final software that I'm creating is to import a
text file containing about 8000 bird observations written in a
unconsistent way and to transform it into a better organized CSV file
or any other file format that can be inported into Excel. The grid is
only there temporarily for me so that I can check that I'm creating
the string manipulating algorithms in the right way. Perhaps I should
import the text file directly into the grid, without going through the
arrays? I have no idea what is the best way to do it. The DataGridView
is a totally new thing for me.
Show us the definition of Add() and it should be obvious what is wrong, and it is quite
possibly obvious what the solution is.
I'm not sure that I know how to do that. Perhaps I can get to the
definition by right-clicking on the word Add() in the code and then
choose "Go to definition". Then I get four different rows to choose
from. This one seems to be the only one of them that also adds
contents to the row that is being created in the grid:
-----
System.Int32 Add(System.Object[] values)
Member of System.Windows.Forms.DataGridViewRowCollection
Summary:
Adds a new row to the collection, and populates the cells with the
specified objects.
Parameters:
values: A variable number of objects that populate the cells of the
new System.Windows.Forms.DataGridViewRow.
Return Values:
The index of the new row.
Exceptions:
System.InvalidOperationException: The associated
System.Windows.Forms.DataGridView control is performing one of the
following actions that temporarily prevents new rows from being
added:Selecting all cells in the control.Clearing the selection.-or-
This method is being called from a handler for one of the following
System.Windows.Forms.DataGridView
events:System.Windows.Forms.DataGridView.CellEnterSystem.Windows.Forms.DataGridView.CellLeaveSystem.Windows.Forms.DataGridView.CellValidatingSystem.Windows.Forms.DataGridView.CellValidatedSystem.Windows.Forms.DataGridView.RowEnterSystem.Windows.Forms.DataGridView.RowLeaveSystem.Windows.Forms.DataGridView.RowValidatedSystem.Windows.Forms.DataGridView.RowValidating-
or-The System.Windows.Forms.DataGridView.VirtualMode property of the
System.Windows.Forms.DataGridView is set to true.- or -The
System.Windows.Forms.DataGridView.DataSource property of the
System.Windows.Forms.DataGridView is not null.-or-The
System.Windows.Forms.DataGridView has no columns. -or-The row returned
by the System.Windows.Forms.DataGridView.RowTemplate property has more
cells than there are columns in the control.-or-This operation would
add a frozen row after unfrozen rows.
System.ArgumentNullException: values is null.
Attributes:
[System.ComponentModel.DesignerSerializationVisibilityAttribute(0)]
-----
Since you didn't specify which of the fifty or
hundred forms of datagrid you are using, it is hard to guess.
Oh, I didn't know about any other than "DataGridView" and the old
"DataGrid" that I found in the Toolbox for C++ (WinForms project).
I note that you are using managed code, but string is not a managed code object.
.
- References:
- Prev by Date: Re: How to create a simple http request
- Next by Date: Re: How do I populate a DataGridView with arrays containing strings? (I get convertion error C2664)
- Previous by thread: Re: How do I populate a DataGridView with arrays containing strings? (I get convertion error C2664)
- Next by thread: Re: How do I populate a DataGridView with arrays containing strings? (I get convertion error C2664)
- Index(es):
Relevant Pages
|