|
mohant$.net wrote: An unhandled exception of type 'System.NullReferenceException' occurred in testexcelwrite.exe
Additional information: Object reference not set to an instance of an object
It clearly saying that some object is not initialize. Please go thorough the code and debugged it. Or show us the code.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Excel.Application XlApp;
Excel._Workbook XlWB;
string workbookPath = "c:/test.xls";
XlWB = XlApp.Workbooks.Open(workbookPath,0,false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
Mohan
|
|
|
|
|
In which line it throwing the exception ? Did you debug the code ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Its giving the exception in
XlWB = XlApp.Workbooks.Open(workbookPath,0,false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
and Exception is:
An unhandled exception of type 'System.NullReferenceException' occurred in testexcelwrite.exe
Additional information: Object reference not set to an instance of an object.
Mohan T
|
|
|
|
|
mohant$.net wrote: XlWB = XlApp.Workbooks.Open(workbookPath,0,false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
I think you need to initialize XlWB
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I got solution...
Actuaally i missed the xlApp.Visable = true;
really sorry..
Thanks Again
Mohan
|
|
|
|
|
Great ! Go ahead !!
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Well clearly you haven't instantiated Excel. XlApp is null. All it takes to understand this is a basic understanding of what a NullReferenceException is and a glance at the code.
|
|
|
|
|
hello all,
i need to add to my app a panel that will contain a display of files like .pdf .doc .txt. from my disk
in other words i want to have a preview of a file after i'm standing on a file name in an open file dialog.
thanks.
modified 31-Dec-20 21:02pm.
|
|
|
|
|
anyone?
modified 31-Dec-20 21:02pm.
|
|
|
|
|
What have you tried? Post your code and soemone will help you fix it, but nobody will write your code for you. Take a look at the System.IO class, that should give you some pointers.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
i didn't asked for code,
i asket for a tool..
like printpreview, but i'm not sure that this is the best..
modified 31-Dec-20 21:02pm.
|
|
|
|
|
sagiko wrote: i asket for a tool..
Well, thats not how your post read. Anyway, as far as I know, you will need to code it yourself as you are within your application.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Perhaps overkill, but you could use the browser component. It won't support things like PDF natively, but if the user has Acrobat Reader (or some other program that is registered as able to open PDF files) the browser will host the viewing application. Of course this means uses may see additional UI (toolbars from the viewer app for example) depending on what they have installed on their system, but they will at least get a "preview" (actually a perfectly normal view, but perhaps scaled down).
Since you're saying "files like ..." it appears you want to show many different formats and you don't necessarily know what they are or what they will be in two years. In that respect the browser is probably a good choice, exactly because it relies upon external programs rather than having built-in support for every format. So a user who has OpenOffice will be able to preview ODT files, and an MS Office user DOC files.
|
|
|
|
|
Hi,
Does anybody can explain or share a link which will explain how to add a Bing Maps into a standalone C# program?
Thanks.
|
|
|
|
|
|
Are you suggesting Bing does not know how to interface its Maps?
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I'm working on a Service in C# that will be run on Windows and on Linux. On Linux you store app config in /etc, but on Windows XP it's "C:\Document and Settings\{USERNAME}\Local Settings\Application Data". How would I go about getting those file paths without having to worry about platform detection?
|
|
|
|
|
The app.config file is usually in the same folder as the .EXE. Assembly.GetExecutingAssembly.Location() will return the full path to the .EXE that is running. You can use the Path class to get just the path without the .EXE filename and use that to build the complete path to the app.config.
|
|
|
|
|
I use Iris Skin for change my program's form's skin but every time that I execute my program show me a messageBox and says you should register
how can I delete this messageBox ?
|
|
|
|
|
Do what it says and register the skining library. You'll have to pay for it, of course.
|
|
|
|
|
|
Hi
I use flowlayoutpanel in my form and i put a button in my flowlayoutpanel and i want to change button location in code but the location of my button doesn't change !
What should i do?
This is my code :
button1.location=new point(300,400);
|
|
|
|
|
From the doc: "The FlowLayoutPanel control arranges its contents in a horizontal or vertical flow direction...", so you have limited say about it. Depending on what it is you want, you might get it by adding a Panel of some Size, then add the Button to that Panel. That will allow you to choose where on the Panel the Button is, however the FLP will decide for you where the Panel goes.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
You cannot precisely position your controls in a FlowLayoutPanel. That is why it is called "flow" layout. If you want to position your controls precisely, then place your controls directly on the container.
|
|
|
|