473,324 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Retrieve data from excel

Ubi
i'm trying to get data out of excel...

my code is:

private void exlSelectionChanged(Range rng)
{
lstFields.Items.Clear();
for (int i=1; i<=rng.Columns.Count ; i++)
{
lstFields.Items.Add( rng.Cells[1,i]).ToString() );
}

(i'm trying to put the first row of the selection into a listbox).
what i get is a listbox full of
System.__ComObject

please help...
Nov 16 '05 #1
1 1586
Ubi,

The Excel COM object does not implement ToString(). You are getting
System._ComObject's (The base for all COM Interop RCWs) implementation of
ToString(), which I believe just returns the type name.

You need to use the Value2 property of the Excel Cell object...

Hope this helps...

Wadih Pazos
Software Architect
Solutions@MBA
www.satmba.com
www.PaperSave.com

"Ubi" <Ub*@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...
i'm trying to get data out of excel...

my code is:

private void exlSelectionChanged(Range rng)
{
lstFields.Items.Clear();
for (int i=1; i<=rng.Columns.Count ; i++)
{
lstFields.Items.Add( rng.Cells[1,i]).ToString() );
}

(i'm trying to put the first row of the selection into a listbox).
what i get is a listbox full of
System.__ComObject

please help...

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris | last post by:
Could someone please provide me an effective means of exporting data from a data set (or data grid) to Excel?
1
by: Steven Stewart | last post by:
I have a user who has been using Excel for a while to keep statistics and print reports. She finds using it cumbersome because of long formulas and a lot of copying and pasting. I have designed...
1
by: murl | last post by:
Is it just me or is there no easy way to open an excel file, and get the column names that are usually in the 1st row? I would like to be able to do this for a import tool im writing in vb.net and...
1
by: funcSter | last post by:
I want to retrieve data from an Excel file like how I would with a database. I understand that I would have to use OLE DB. Somehow I think I cannot get the connection string right, as the bit of...
1
by: John Yung | last post by:
Hi, I have a client (C# MS Excel Project) calling a Web Service to retrieve and update data. One of the business requirement is the client's NT Login ID, IP Address and computer name must be log...
8
by: Yoshitha | last post by:
Hi I want to Extracet(retrieve) data from some of websites and the retrieved data has to be saved in excel or.csv files. I need to develop this in ASP.net(using C#.net Vs 2003). Can any...
1
by: RajithaV | last post by:
Hi, I am developing a web application using ASP.Net I am using sql server.My coding is in VB.net I want to know how to move data from excel file into the Database. I also need to know how to...
1
by: friendlyrohit | last post by:
Hi All !!! Can anybody help me out, how to retrieve a desired column's data from an existing excel sheet through the vb code....... Dim strData As String Dim ts As TextStream ...
0
by: Grip | last post by:
Hi, I have gone throught the group and Microsoft's online help and have seen many suggestions but I am still seeking clarity: 1. I have an excel spreadsheet. Column A contains text that may...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.