The problem with many of these MSWord methods is that they have many parameters and it not easy to know which combinations are valid. I would suggest simplifying the HitHighlight method call and just specify the text to find, as that is the only required parameter. Set all others to Type.Missing. If that works as expected then reintroduce the other parameters, possibly one at a time.
There are warnings in the documentation that some parameters "may not be available", e.g. HanjaPhoneticHangul is available only if you have support for Korean languages. This may mean that it must be set to Type.Missing and not true or false. The documentation is not clear about this.
In a C# 2008 windows application, I planning on locating files that I need to find by utilizing the following code:
var RFiles = from path in Directory.EnumerateFiles(filesaveLocation, "*.*",
let extension = Path.GetExtension(path)
where extension == ".pdf" || extension == ".xlsx" || extension == ".xls"select path;
However once I find each selected file, I need to know the exact location of where each specified file was located. I need to be able to store the exact directory structure location in a sql server 2008 r2 database.
Basically the code statement would be similar to tell me exactly where each seelcted file is located at.
Thus can you me in code and/or explain to me how to accomplish my goal?
In this case, you can switch to use the DirectoryInfo class to do this:
DirectoryInfo filesaveDir = new DirectoryInfo(filesaveLocation);
var RFiles = from fi in filesaveDir.EnumerateFiles("*.*", SearchOption.AllDirectories)
let extension = fi.Extension
where extension == ".pdf" || extension == ".xlsx" || extension == ".xls"select fi.FullName;
why do you want to move a corrupt database into Oracle? surely you should fix the SQL Database first
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
I recently finished a C# course and I'm ready to create what could be a complex program, to me at least. The idea I have is to monitor a cad application that runs on the users machine and work on a design file locally but save it to the server every x number of minutes.
Users currently work on the files on a blade server that backups are mediocre at best, a network running at 100 and not gigabit.
After reading a few articles here on C# threads and processes I now have a few questions.
Can C# monitor when the application starts\ends via the task manager and get the file path and name so I can then do a time\date compare with the version on the server vs. the one on the local machine?
Anything to consider C# wise if a second instance of the application is started? They would be two different drawings and the task manager does show two applications and processes running.
Can this be set as a service to launch, or what would be the best way to implement this once a user logs on to the machine to catch the start of the application?
Should the FileSystemWatcher or EventHandler reduce the complexity?
Any input or guides to an example already existing is appreciated.
Or should I just stay with the "Hello World" example in the book?
I'll tell you what, then. Why don't you call me some time when you have no class? - Thornton Melon
You can try System.Diagnostics.Process.GetProcessesByName to get a list of Processes. But I do not know an event for a Process being started (perhaps WMI could do so), I'd poll the list every few seconds. But more important: how much interoperation does the application to be montired allow? Can you query its current file? Is the file read-able when it is opened in that application (could be locked!)?