Click here to Skip to main content
15,902,447 members
Home / Discussions / C#
   

C#

 
GeneralRe: 'using' vs fully qualified types Pin
PIEBALDconsult18-Aug-07 18:40
mvePIEBALDconsult18-Aug-07 18:40 
GeneralRe: 'using' vs fully qualified types Pin
Colin Angus Mackay19-Aug-07 0:06
Colin Angus Mackay19-Aug-07 0:06 
AnswerRe: 'using' vs fully qualified types Pin
Paul Conrad18-Aug-07 3:29
professionalPaul Conrad18-Aug-07 3:29 
AnswerRe: 'using' vs fully qualified types Pin
Guffa18-Aug-07 6:24
Guffa18-Aug-07 6:24 
AnswerRe: 'using' vs fully qualified types Pin
Luc Pattyn18-Aug-07 7:43
sitebuilderLuc Pattyn18-Aug-07 7:43 
GeneralRe: 'using' vs fully qualified types Pin
PIEBALDconsult18-Aug-07 12:28
mvePIEBALDconsult18-Aug-07 12:28 
GeneralRe: 'using' vs fully qualified types Pin
Luc Pattyn18-Aug-07 12:53
sitebuilderLuc Pattyn18-Aug-07 12:53 
GeneralRe: 'using' vs fully qualified types Pin
PIEBALDconsult18-Aug-07 18:49
mvePIEBALDconsult18-Aug-07 18:49 
AnswerRe: 'using' vs fully qualified types Pin
PIEBALDconsult18-Aug-07 9:52
mvePIEBALDconsult18-Aug-07 9:52 
GeneralRe: 'using' vs fully qualified types Pin
Colin Angus Mackay18-Aug-07 13:32
Colin Angus Mackay18-Aug-07 13:32 
GeneralRe: 'using' vs fully qualified types Pin
Mark Churchill18-Aug-07 16:10
Mark Churchill18-Aug-07 16:10 
GeneralRe: 'using' vs fully qualified types Pin
PIEBALDconsult18-Aug-07 18:37
mvePIEBALDconsult18-Aug-07 18:37 
AnswerRe: 'using' vs fully qualified types Pin
PIEBALDconsult18-Aug-07 18:53
mvePIEBALDconsult18-Aug-07 18:53 
QuestionProblem with text editor - Plz Help( need badly) Pin
Hum Dum17-Aug-07 22:07
Hum Dum17-Aug-07 22:07 
AnswerRe: Problem with text editor - Plz Help( need badly) Pin
Christian Graus17-Aug-07 22:42
protectorChristian Graus17-Aug-07 22:42 
AnswerRe: Problem with text editor - Plz Help( need badly) Pin
Luc Pattyn18-Aug-07 0:22
sitebuilderLuc Pattyn18-Aug-07 0:22 
QuestionHow to Access Main Class in Inner Class ... Pin
Doug.Chen17-Aug-07 21:43
Doug.Chen17-Aug-07 21:43 
AnswerRe: How to Access Main Class in Inner Class ... Pin
Hessam Jalali17-Aug-07 22:00
Hessam Jalali17-Aug-07 22:00 
AnswerRe: How to Access Main Class in Inner Class ... Pin
Christian Graus17-Aug-07 22:44
protectorChristian Graus17-Aug-07 22:44 
AnswerRe: How to Access Main Class in Inner Class ... Pin
Luc Pattyn18-Aug-07 0:26
sitebuilderLuc Pattyn18-Aug-07 0:26 
Questiontool tip in Close box Pin
topksharma198217-Aug-07 21:16
topksharma198217-Aug-07 21:16 
QuestionNo overload for method 'Open' takes '13' arguments.... Pin
shafikshafik17-Aug-07 20:49
shafikshafik17-Aug-07 20:49 
dear sir,
i want read an excel file and open it to listview but now two exception throws would u help me.....its very urgent.

exceptions:
==============
1. No overload for method 'Open' takes '13' arguments
2. Property, indexer, or event 'Value' is not supported by the language; try directly calling accessor methods 'Excel.Range.get_Value(object)' or 'Excel.Range.set_Value(object, object)'



source code:
===============
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//using System.Office.Interop.Excel;


//private Excel.Application ExcelObj = null;


namespace Project_test1
{

public partial class Form1 : Form
{

private Excel.Application ExcelObj = null;

public Form1()
{
// Initialize the Windows Components
InitializeComponent();
ExcelObj = new Excel.Application();
// See if the Excel Application Object was successfully constructed
if (ExcelObj == null)
{
MessageBox.Show("ERROR: EXCEL couldn't be started!");
System.Windows.Forms.Application.Exit();
}
// Make the Application Visible
ExcelObj.Visible = true;



}

string[] ConvertToStringArray(System.Array values)
{
// create a new string array
string[] theArray = new string[values.Length];
// loop through the 2-D System.Array and populate the 1-D String Array
for (int i = 1; i <= values.Length; i++)
{
if (values.GetValue(1, i) == null)
theArray[i - 1] = "";
else
theArray[i - 1] = (string)values.GetValue(1, i).ToString();
}
return theArray;
}


private void Form1_Load(object sender, EventArgs e)
{

}

private void btn_Click(object sender, EventArgs e)
{
// prepare open file dialog to only search for excel files (had trouble setting this in design view)
this.openFileDialog1.FileName = "*.xls";
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
// Here is the call to Open a Workbook in Excel
// It uses most of the default values (except for the read-only which we set to true)
Excel.Workbook theWorkbook = ExcelObj.Workbooks.Open(openFileDialog1.FileName, 0, true, 5,
"", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true);
// get the collection of sheets in the workbook
Excel.Sheets sheets = theWorkbook.Worksheets;
// get the first and only worksheet from the collection of worksheets
Excel.Worksheet worksheet = (Excel.Worksheet)sheets.get_Item(1);
// loop through 10 rows of the spreadsheet and place each row in the list view
for (int i = 1; i <= 3; i++)
{
Excel.Range range = worksheet.get_Range("A" + i.ToString(), "J" + i.ToString());
System.Array myvalues = (System.Array)range.Cells.Value;
string[] strArray = ConvertToStringArray(myvalues);
listView1.Items.Add(new ListViewItem(strArray));
}
}

}

i add :
=========
Microsoft Excel 9.0 Objects Library.
AnswerRe: No overload for method 'Open' takes '13' arguments.... Pin
Christian Graus17-Aug-07 20:57
protectorChristian Graus17-Aug-07 20:57 
AnswerRe: No overload for method 'Open' takes '13' arguments.... Pin
Luc Pattyn18-Aug-07 0:26
sitebuilderLuc Pattyn18-Aug-07 0:26 
QuestionImporting xsd Pin
dnlstffrd17-Aug-07 19:57
dnlstffrd17-Aug-07 19:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.