Click here to Skip to main content
15,922,155 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# translation to vb.net Pin
webspeed27-Nov-09 2:29
webspeed27-Nov-09 2:29 
AnswerRe: C# translation to vb.net Pin
Vimalsoft(Pty) Ltd27-Nov-09 3:17
professionalVimalsoft(Pty) Ltd27-Nov-09 3:17 
GeneralRe: C# translation to vb.net Pin
webspeed27-Nov-09 4:13
webspeed27-Nov-09 4:13 
GeneralRe: C# translation to vb.net Pin
EliottA27-Nov-09 5:12
EliottA27-Nov-09 5:12 
GeneralRe: C# translation to vb.net Pin
0x3c027-Nov-09 10:23
0x3c027-Nov-09 10:23 
QuestionUser Log Maintance Pin
Isaac Gordon27-Nov-09 0:07
Isaac Gordon27-Nov-09 0:07 
AnswerRe: User Log Maintance Pin
dan!sh 27-Nov-09 0:23
professional dan!sh 27-Nov-09 0:23 
Question[Solved]Excel issue or dumb user? Pin
cburlacu26-Nov-09 21:03
cburlacu26-Nov-09 21:03 
Hello,

I have an app that use an excel component(ocxt.com). This component have a strange behavior, which I reproduced it with Interop.Excel.

Bellow is the functions with I open and close an excel file programatically:
private ApplicationClass app = null;
private Workbook book = null;
private Worksheet sheet = null;

...

private void openExcel(string fileName)
{
	if (app != null)
		closeExcel();
	app = new ApplicationClass();

	app.Visible = false;
	app.ScreenUpdating = false;
	app.DisplayAlerts = false;
	book = app.Workbooks.Open(fileName, Missing.Value, Missing.Value, Missing.Value,
									   Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
									   Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
									   Missing.Value);
	sheet = (Worksheet)book.Sheets[1];
}

void closeExcel()
{
	if (sheet != null)
	{
		System.Runtime.InteropServices.Marshal.ReleaseComObject(sheet);
		sheet = null;
	}

	if (book != null)
	{
		book.Close(false, Missing.Value, Missing.Value);
		System.Runtime.InteropServices.Marshal.ReleaseComObject(book);
		book = null;
	}
	

	if (app != null)
	{
		app.Quit();
		System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
	}
	app = null;

	GC.Collect();
}


If I have 2 files: 1.xls and 2.xls and 1.xls I always open with .net code, and 2.xls double clicking it. There is 2 undesired (for me) behaviors:

1. If I open first by code file 1.xls, and then try to open 2.xls from Windows Explorer, 2.xls doesn't open. It only open an inactive Excel.
2. When I close by code 1.xls, it close 2.xls too.

What I do wrong?
Thank you.
AnswerRe: Excel issue or dumb user? Pin
ScottM126-Nov-09 22:07
ScottM126-Nov-09 22:07 
GeneralRe: Excel issue or dumb user? Pin
cburlacu26-Nov-09 22:45
cburlacu26-Nov-09 22:45 
GeneralRe: Excel issue or dumb user? Pin
dan!sh 26-Nov-09 23:21
professional dan!sh 26-Nov-09 23:21 
GeneralRe: Excel issue or dumb user? Pin
cburlacu27-Nov-09 1:41
cburlacu27-Nov-09 1:41 
GeneralRe: Excel issue or dumb user? Pin
EliottA27-Nov-09 1:45
EliottA27-Nov-09 1:45 
AnswerRe: Excel issue or dumb user? Pin
cburlacu27-Nov-09 1:57
cburlacu27-Nov-09 1:57 
Questionwants to display rows in a powerpoint using vs2008 Pin
dsaikrishna26-Nov-09 19:04
dsaikrishna26-Nov-09 19:04 
AnswerRe: wants to display rows in a powerpoint using vs2008 Pin
dan!sh 26-Nov-09 19:31
professional dan!sh 26-Nov-09 19:31 
AnswerRe: wants to display rows in a powerpoint using vs2008 Pin
ScottM126-Nov-09 22:08
ScottM126-Nov-09 22:08 
GeneralRe: wants to display rows in a powerpoint using vs2008 Pin
dsaikrishna26-Nov-09 22:32
dsaikrishna26-Nov-09 22:32 
GeneralRe: wants to display rows in a powerpoint using vs2008 Pin
ScottM126-Nov-09 22:37
ScottM126-Nov-09 22:37 
GeneralRe: wants to display rows in a powerpoint using vs2008 Pin
dsaikrishna26-Nov-09 22:47
dsaikrishna26-Nov-09 22:47 
QuestionAbout dateTimePicker problem Pin
miss YY26-Nov-09 18:01
miss YY26-Nov-09 18:01 
AnswerRe: About dateTimePicker problem Pin
avigodse26-Nov-09 18:56
professionalavigodse26-Nov-09 18:56 
AnswerRe: About dateTimePicker problem Pin
Shameel26-Nov-09 20:05
professionalShameel26-Nov-09 20:05 
AnswerRe: About dateTimePicker problem Pin
ScottM126-Nov-09 22:13
ScottM126-Nov-09 22:13 
GeneralRe: About dateTimePicker problem Pin
PIEBALDconsult27-Nov-09 2:59
mvePIEBALDconsult27-Nov-09 2:59 

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.