|
Hello All,
Ive got a difficulty regarding opening files in their respective editors...I have to develop an application where I need to say open a pdf file in AcrobatReader,doc file in Word,image in image editor...
Please do let me know if ne1 has solution to this....atleast reference to what i can do to solve this...
|
|
|
|
|
Each file-extension has a binding to a program that is used to open them. That's how the Windows Explorer knows that it should start "WordPad" for ".doc" files if you don't have Microsfot Word installed. Once Word is installed, it will use Word, as this gets associated with the file-extension during the installation.
If you just want to "open" the file with the correct editor, then you can simply use "Proces.Start" to start the document - it will open the document with whatever editor the user has associated with the file-extension.
If you want to display the editor-name in, say, a listbox, you'll have to dig deeper.
I are troll
|
|
|
|
|
bhagyashri.biyani wrote: I have to develop an application where I need to say open a pdf file in AcrobatReader,doc file in Word,image in image editor
Why do you have to develop that app when Windows Explorer already does that and comes free with Windows OS?
|
|
|
|
|
i need validations for textbox in my windows form .
pls help.
Swap
|
|
|
|
|
You will need to write your own code in the Validating event.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
|
Hi there,
I'm using the .NET 2.0 WebBrowser control in a windows form app, running on XP SP2.
Some of my users are getting the classic 'Access Denied' security exception when dropping into the Document_Completed event handler. I think the exception is happening when trying to access the .Document object of the WebBrowser control.
I know there are issues with frames, and cross domain requests using the WebBrowser control, but the website I'm hitting doesn't use frames and is on the local intranet. When the users try accessing the URL in a normal IE window, it loads fine. Must be something to do with the .Document object and user permissions?
The kicker is that some users are working fine on XP SP2, so I'm thinking it's permissions, any ideas?
Much appreciated,
thanks.
|
|
|
|
|
Hi,
scootrobertson wrote: Access Denied' security exception when dropping into the Document_Completed event handler
Don't stare at Exception.Message; instead look at the line numbers when you investigate Exception.ToString() and teach your IDE to always show line numbers (Visual Studio: Tools/Options/TextEditor/AllLanguages...), that way you will know exactly what line throws it.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I've solved this now, and here's how I did it, if anyone else has similar issues...
I just added the following code to the OnLoad of the form, after the Navigate() call:
while (wbs.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
I also stopped initialising the browser control with 'about:blank', instead just navigating straight to my target page without going to 'about:blank' first.
I think what was happening is the DocumentCompleted handler was trying to access the wbs.Document property before it was initialised, if thats possible(!), and throwing an error. Weird thing was, this was just happening on some user's PCs, and not others.
Anyway, adding the while loop and removing the load of the about:blank first, seems to have fixed it.
scott.
|
|
|
|
|
hi,
i had made an windows application with a word document embedded in it.now i want to add a task pane inside the windows application.i tried this .
myUserControl1 = New UserControl1
objCustomTaskPanes = New CustomTaskPaneCollection
myCustomTaskPane = objCustomTaskPanes.Add(myUserControl1, "My Task Pane")
myCustomTaskPane.Visible = True
but this is not working ..please help
ash
|
|
|
|
|
hi i am using on windows form c# vs 2005 which i found to be very useful.
i was introduced Microsoft.Office.Interop.Excel after asking for advice in another post.
i am now trying to get the Microsoft.Office.Interop.Excel to instead of creating a new excel spreadsheet. but use an existing excel file which i drag into my workspace.
i also found
oXL.Workbooks.Open however i cant seem to be able to use it and i am not able to make it open the file in my workspace as well
anyone know how this can be done?
modified on Sunday, February 15, 2009 5:13 AM
|
|
|
|
|
neodeaths wrote: which i drag into my workspace
what do you mean by that ?
If you can state your exact difficulty someone can help you.See if this helps [^]
|
|
|
|
|
my difficulty now is that i cant seem to be able to open an existing xls file and edit the infomation.
also since the xls file is saved in my project workspace as i am trying to make it to a resouces path it in a way to use it
generally wat i am trying to achieve is to make my window form open a file form my project workspace and edit to info
|
|
|
|
|
If you have problems with finding the path, this might help you [^]
And since you would be editing you need to set the ReadOnly in Open call to false[^]
|
|
|
|
|
hi i am using visual studio 2005 c# windows form
what i am trying to do is to make my window form write a excel file with the data it have.
however i not sure what is the right procedure as i am tring to do it programmically.
i read a few articals about ado how ever they seem to show how excel is brought into the windows form
and not out.
|
|
|
|
|
This should get you going. You need to add a reference to Microsoft.Office.Interop.Excel
using Excel = Microsoft.Office.Interop.Excel;
OleDbCommand cmd;
using (OleDbConnection con = new OleDbConnection(string.Format("Data Source={0};" + "Provider=Microsoft.Jet.OLEDB.4.0;" + "Extended Properties=Excel 8.0;", fileName)))
{
con.Open();
string sqlToRun = "Create table [test] (Col1 int)";
string insert = "insert into [test](col1) values (100)";
cmd = new OleDbCommand(sqlToRun, con);
cmd.ExecuteNonQuery();
cmd = new OleDbCommand(insert, con);
cmd.ExecuteNonQuery();
}
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
|
I don't know on which forum i should post this, so i hope this is the right one since it has to do with windows forms projects..
The problem is the following, i have 2 simple projects (both windows application projects). Both the projects contain 1 form. In one of those forms i placed a button, if you press the button the form of the other project will open. (This is not my actual project, but a simplified version to recreate my problem)
Now i wish to publish my first project (the one with the form with the button), but visual studio keeps generating the following errors
A signing key is required in order to publish this project. Publishing from Visual Studio 2005 will automatically configure a signing key for this project.
and
Cannot publish because a project failed to build.
however, both projects build and run fine when debugging.
if i go to the properties, to the signing tab, and check "Sign the ClickOnce manifests", the same error keeps occuring.
Does anyone have any ideas how to solve this?
|
|
|
|
|
For signing, go to project Properties, Signing tab, and:
1. check Sign the assembly
2. select New for "Choose a strong name key file"
3. fill in the name of the key and psw
Calin
|
|
|
|
|
thanks for the quick reply.
But signing the assembly (for both projects) doesn't seem to solve the problem. the same error occures.
I tried adding test certificates to both projects, now i get an error that the manifest file can not be found...
ps: i'm using visual studio 2005
|
|
|
|
|
I have developed a windows application in C#.net that is running in the background like an antivirus.
But the problem is whenever i try to switch off my computer or try to restart my computer, the computer doesn't turns off/restarts.
And when i individually kills that windows(.exe) application listed out in Processes tab in Windows Task Manager and then tries to switch off the computer or restart it, Everything seems to be fine. How could i enhance or optimize my code so that whenever computer is turned off or is restarted, my application process should be killed automatically. Is there any class in .Net that could possibly find out , when computer is switched off or is restarted, so that i could kill down my application process at that time.
Anyone who could help me out in fixing the bug.
Thanks in Advance!!
Aspiring Techie,
Vishnu Nath
|
|
|
|
|
When Windows wants to shut down it attempts to close all running applications cooperatively and your app must have refused that close request.
Have you coded a FormClosing event handler to stop the application closing?
e.g.
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
e.Cancel = true;
}
The good news is that you can fix it.
Take a look at the FormClosingEventArgs.CloseReason Property and code something like this.
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
if (e.CloseReason == CloseReason.WindowsShutDown) {
e.Cancel = false;
} else {
e.Cancel = true;
}
}
Alan.
modified on Thursday, February 12, 2009 11:17 AM
|
|
|
|
|
You are right Alan.
I have coded the same way as u have mentioned, to keep my apps running in the background.
Now i will change the code to your mentioned code.
Thanks for the solution.
Anyways is there any method where i can start my application and put the notification icon in system tray silently in the background, whenever computer is switched on or is restarted. It is similar to Gtalk or anti- virus starting their application whenever computer is turned on or is restarted.
And also Alan, i want my application to behave like system process, so that
no one could possibly kill that process from windows task manager processes list, except when computer is switched off. I have seen that you can cannot kill anti-virus processes from windows task manager.
How do one convert their application into system processes ensuring that the application could not be killed by administrator of computer(except when comp is switched off).
Looking for a solution to this Alan!
Aspiring Techie,
Vishnu Nath
|
|
|
|
|
Vishnu Nath wrote: I have seen that you can cannot kill anti-virus processes from windows task manager.
You mean that you don't know how to kill that antivirus proces - that doesn't mean that it's not possible. I'm killing the Norton-scanner prior to each build, since Visual Studio requires the resources.
Vishnu Nath wrote: could not be killed by administrator of computer
I'd consider that a ransom-situation. The administrator owns the damn machine, and should have some control over what it does. Such programs are "malware" and Norton (or Avast, or MacAfee if they still exist) will try to remove it.
There's a huge difference in limiting the enduser and in limiting the administrator. Be carefull not to mix up both user-types
I are troll
|
|
|
|
|
You are right.
Thanks for your valuable advice and an important guidance to my project.
Thanks a Lot!!
Aspiring Techie,
Vishnu Nath
|
|
|
|