Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
QuestionValue change of Entity in a ObservableCollection<T> Pin
Saiyed Alam21-Apr-10 22:32
Saiyed Alam21-Apr-10 22:32 
QuestionHow to fetch file from a folder within.the application Pin
NetMan201221-Apr-10 22:28
NetMan201221-Apr-10 22:28 
AnswerRe: How to fetch file from a folder within.the application Pin
Ice_Freez0521-Apr-10 22:45
Ice_Freez0521-Apr-10 22:45 
GeneralRe: How to fetch file from a folder within.the application Pin
NetMan201221-Apr-10 23:04
NetMan201221-Apr-10 23:04 
GeneralRe: How to fetch file from a folder within.the application Pin
Anindya Chatterjee21-Apr-10 23:14
Anindya Chatterjee21-Apr-10 23:14 
QuestionDataGridView Grouping Pin
Syed Shahid Hussain21-Apr-10 22:08
Syed Shahid Hussain21-Apr-10 22:08 
AnswerRe: DataGridView Grouping Pin
Eddy Vluggen22-Apr-10 1:34
professionalEddy Vluggen22-Apr-10 1:34 
QuestionExcel remains in memory Pin
KaurGurpreet21-Apr-10 21:28
KaurGurpreet21-Apr-10 21:28 
I have written the simple code as below:
Addede reference (C:\Program Files\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11\Microsoft.Office.Interop.Excel.dll)


private void button1_Click(object sender, EventArgs e)
{
Microsoft.Office.Interop.Excel.Application _objAppln;
Microsoft.Office.Interop.Excel.Workbook _objWorkBook=null ;

_objAppln = new Microsoft.Office.Interop.Excel.Application(); // To initialize excel file

if (_objAppln != null)
{
_objWorkBook = _objAppln.Workbooks.Add(Type.Missing); // To add workbook with sheets in excel file
//_objWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)_objWorkBook.ActiveSheet; // To get the current active sheet in excel file
}
string _fileName = "temp.xls";

_objWorkBook.SaveAs(_fileName,
Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, false, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
_objWorkBook.Close(true, _fileName, false);


_objAppln.Quit();
_objWorkBook = null;
_objAppln = null;
}

After the code is execuled, the instance of Excel (EXCEL.exe) is seen in taskbar. I have as many number of instances, as many times I click on the button.
The instance exists even when I stop the application.

What is wrong in the above code.
Gurpreet

AnswerRe: Excel remains in memory Pin
m@u21-Apr-10 21:57
m@u21-Apr-10 21:57 
GeneralRe: Excel remains in memory Pin
KaurGurpreet21-Apr-10 22:32
KaurGurpreet21-Apr-10 22:32 
AnswerRe: Excel remains in memory Pin
Mirko198022-Apr-10 0:42
Mirko198022-Apr-10 0:42 
AnswerRe: Excel remains in memory Pin
Eddy Vluggen22-Apr-10 2:31
professionalEddy Vluggen22-Apr-10 2:31 
QuestionCompare two datarows Pin
NarVish21-Apr-10 21:15
NarVish21-Apr-10 21:15 
AnswerRe: Compare two datarows Pin
OriginalGriff21-Apr-10 21:44
mveOriginalGriff21-Apr-10 21:44 
GeneralRe: Compare two datarows Pin
NarVish21-Apr-10 22:23
NarVish21-Apr-10 22:23 
GeneralRe: Compare two datarows Pin
OriginalGriff21-Apr-10 22:36
mveOriginalGriff21-Apr-10 22:36 
QuestionHow to display 2 relational tables in a single DataGridView Pin
shivapriyak21-Apr-10 20:40
shivapriyak21-Apr-10 20:40 
AnswerRe: How to display 2 relational tables in a single DataGridView Pin
AspDotNetDev21-Apr-10 21:30
protectorAspDotNetDev21-Apr-10 21:30 
AnswerRe: How to display 2 relational tables in a single DataGridView Pin
Sriniavs Ganaparthi23-Mar-11 20:58
Sriniavs Ganaparthi23-Mar-11 20:58 
QuestionHi, i need help in creating video player for windows mobile..... Pin
Petar Efnushev21-Apr-10 15:45
Petar Efnushev21-Apr-10 15:45 
AnswerRe: Hi, i need help in creating video player for windows mobile..... Pin
Not Active21-Apr-10 16:43
mentorNot Active21-Apr-10 16:43 
QuestionColoring string when painting text Pin
Chris Copeland21-Apr-10 15:38
mveChris Copeland21-Apr-10 15:38 
AnswerRe: Coloring string when painting text Pin
Luc Pattyn21-Apr-10 15:54
sitebuilderLuc Pattyn21-Apr-10 15:54 
GeneralRe: Coloring string when painting text Pin
Chris Copeland21-Apr-10 16:02
mveChris Copeland21-Apr-10 16:02 
GeneralRe: Coloring string when painting text Pin
Luc Pattyn21-Apr-10 16:55
sitebuilderLuc Pattyn21-Apr-10 16:55 

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.