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

C#

 
GeneralRe: Security in C# .net application Pin
Anonymous20-Aug-05 16:29
Anonymous20-Aug-05 16:29 
GeneralRe: Security in C# .net application Pin
mav.northwind20-Aug-05 20:44
mav.northwind20-Aug-05 20:44 
GeneralRe: Security in C# .net application Pin
Colin Angus Mackay20-Aug-05 23:05
Colin Angus Mackay20-Aug-05 23:05 
GeneralRenaming Files & ListView Pin
mikesinfo20-Aug-05 6:40
mikesinfo20-Aug-05 6:40 
Generalsave/load an arraylist without serialization Pin
misterangus20-Aug-05 6:22
misterangus20-Aug-05 6:22 
GeneralRe: save/load an arraylist without serialization Pin
Daniel132421-Aug-05 6:16
Daniel132421-Aug-05 6:16 
GeneralRe: save/load an arraylist without serialization Pin
misterangus21-Aug-05 7:02
misterangus21-Aug-05 7:02 
GeneralC# and Excel Pin
Member 217694920-Aug-05 5:27
Member 217694920-Aug-05 5:27 
I am trying to read some data from Microsoft Excel 2002 with a C# windows Form. I have read that I must include a .COM in my references. Going through that process I believe that I have built up my code correctly to open a new workbook and see it on the screen. I have included the code below. When I build the code I get a message saying-

The type or namespace name 'Interop' does not exist in the class or namespace 'Microsoft.Office' (are you missing an assembly reference?)

Can anyone provide me with some guidance on this subject? Thanks


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Microsoft.Office.Interop.Excel;
using System.Reflection;
using System.IO;

namespace faultmap_with_labels
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(264, 80);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(816, 678);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
Application.Run(new Form1());
}

private void button1_Click(object sender, System.EventArgs e)
{
// Make an instance of Excel.
Microsoft.Office.Interop.Excel.ApplicationClass excel =
new Microsoft.Office.Interop.Excel.ApplicationClass();

// Show Excel on the desktop. (fast = running in the background)
excel.set_Visible( true );
}


}
}

GeneralRe: C# and Excel Pin
wout de zeeuw20-Aug-05 7:26
wout de zeeuw20-Aug-05 7:26 
GeneralRe: C# and Excel Pin
seee sharp21-Aug-05 18:52
seee sharp21-Aug-05 18:52 
Generaluse the Console in a Windows Application Pin
Diego12320-Aug-05 1:33
Diego12320-Aug-05 1:33 
GeneralRe: use the Console in a Windows Application Pin
User 665820-Aug-05 1:36
User 665820-Aug-05 1:36 
GeneralRe: use the Console in a Windows Application Pin
Diego12320-Aug-05 2:10
Diego12320-Aug-05 2:10 
GeneralRe: use the Console in a Windows Application Pin
Guffa20-Aug-05 2:48
Guffa20-Aug-05 2:48 
GeneralRe: use the Console in a Windows Application Pin
Luis Alonso Ramos20-Aug-05 7:31
Luis Alonso Ramos20-Aug-05 7:31 
GeneralRedirecting in and output from a spawned console app Pin
Diep-Virezer20-Aug-05 1:21
Diep-Virezer20-Aug-05 1:21 
GeneralRe: Redirecting in and output from a spawned console app Pin
tadass20-Aug-05 4:53
tadass20-Aug-05 4:53 
GeneralRe: Redirecting in and output from a spawned console app Pin
Diep-Virezer20-Aug-05 5:00
Diep-Virezer20-Aug-05 5:00 
GeneralRe: Redirecting in and output from a spawned console app Pin
tadass20-Aug-05 5:57
tadass20-Aug-05 5:57 
GeneralRe: Redirecting in and output from a spawned console app Pin
Diep-Virezer20-Aug-05 6:48
Diep-Virezer20-Aug-05 6:48 
Generaluser32.dll Pin
alex_kl20-Aug-05 0:25
alex_kl20-Aug-05 0:25 
GeneralRe: user32.dll Pin
User 665820-Aug-05 1:06
User 665820-Aug-05 1:06 
GeneralRe: user32.dll Pin
gnjunge20-Aug-05 7:45
gnjunge20-Aug-05 7:45 
GeneralRe: user32.dll Pin
alex_kl21-Aug-05 5:21
alex_kl21-Aug-05 5:21 
GeneralClear DataGrid Pin
Member 220452219-Aug-05 22:27
Member 220452219-Aug-05 22:27 

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.