My ListView displays System.Object[]

F

forest demon

the code below displays System.Object[] in (columnCount) of my
listview. the arraylist (qResults) consists of objects which are
arrays, such as: object[] rowArray = new object[numberOfColumns];
i know it's something trivial, but i'm trying to figure this out at
4am and i'm half in the bag.
thanks ahead of time folks.....i appreciate any and all input.

int columnCount = 5;
int nCol = 0;
ListViewItem lvItem;
ArrayList qResults = new ArrayList();

qResults = cBuilder.PCBQuery("ACCESS_DB_CONN", queryString,
columnCount);

for (int i = 0; i <= qResults.Count; i++)
{
nCol = 0;
lvItem = lvPCB.Items.Add(qResults[nCol++].ToString());
for (; nCol < columnCount; nCol++)
{
lvItem.SubItems.Add(qResults[nCol].ToString());
}
}
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


| the code below displays System.Object[] in (columnCount) of my
| listview. the arraylist (qResults) consists of objects which are
| arrays, such as: object[] rowArray = new object[numberOfColumns];
| i know it's something trivial, but i'm trying to figure this out at
| 4am and i'm half in the bag.

What about casting the type to its correct type and then calling ToString()
, like if

lvItem.SubItems.Add( Convert.ToInt32( qResults[nCol]).ToString() );
 
F

forest demon

Hi,


| the code below displays System.Object[] in (columnCount) of my
| listview. the arraylist (qResults) consists of objects which are
| arrays, such as: object[] rowArray = new object[numberOfColumns];
| i know it's something trivial, but i'm trying to figure this out at
| 4am and i'm half in the bag.

What about casting the type to its correct type and then calling ToString()
, like if

lvItem.SubItems.Add( Convert.ToInt32( qResults[nCol]).ToString() );

i think i have a solution....thanks for your input.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top