Run a process (Can be wait for that process to exit before continuing)
Private Sub CallProcess(ByVal path As String, ByVal Arguments As String, ByVal WindowStyle As ProcessWindowStyle, ByVal WaitForExit As Boolean)
If System.IO.File.Exists(path) Then
Dim p As New System.Diagnostics.Process
p.StartInfo.FileName = path p.StartInfo.Arguments = Arguments p.StartInfo.WindowStyle = WindowStyle p.StartInfo.ErrorDialog = True
p.Start()
'Wait until the process passes back an exit code If WaitForExit Then p.WaitForExit() p.Close() End If
End If
End Sub
Implementation
CallProcess("C:\Acrobat 6.0\Reader\AcroRd32.exe", String.Empty, processWindowStyle.Maximized, False)
Ericsw,
Its very nice of you to share these code snippets, but it would be even better that you put the subject to the nature of the snippet instead of just a running number. I'm sure it will be much easier for you to refer next time, and others can see the nature of the snippets immediately.
Best Regards, Kit Kai, MVP (SharePoint Portal Server)
I have to agree with kitkai that the subject of the post is too weird. At first, I thought it was a series of code-dump from a program for trouble-shooting purpose and I didn't even bother to click on it. Only today, I read all 9 of them and found out that they are quite useful.
How about posting the code snippets as short articles? We do have an article section here. More elaboration may be needed though instead of plain code-dumps.
Thank for feedback . In future I will put the serial into the message body. The series just for me to keep track how many code snippet has been posted. I'm will very appreciate if we can have a code library section to keep all the code snippet.
If all of the member can contribute one or two code snippet per week, it will become a huge library and bring greater benefit to all of us.
All the code snippet can be simply cut and paste. Hereby you can simply keep it in anywhere you want. Personally don't recommend to keep in project format because it hard to find.
All the code may not perfect, I very appreciate if someone can improve it.
Recommended Tools for keep your code.
http://www.garybeene.com/free/fr-librarians.htm
For those are using VS 2005, is that any great tool for keep the code snippet?
ericwsw wrote:All the code snippet can be simply cut and paste. Hereby you can simply keep it in anywhere you want. Personally don't recommend to keep in project format because it hard to find.
The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral
Hmm ... u may have some miss understanding. I post the code snippet because is simple and easy to digest by more of reader especially for the beginner. Actually, they are freely to build their own component using the code snippet. Or they can copy and paste to keep somewhere for future reference.
Agree with you for the componet re-used concept and I always promote that. Actually more of the code snippet is part of my re-useable component. By the way not all the time the code need to repeat and repeat again, is practical to build as a class, hereby code snippet will become very useful, just copy and paste the code and then configure it. In this scenerior, I classify it as code template.
Thank. But it seem not working with my Norton Firewall, hence I have to give up. Are you using it?
Personally, I'm using CodeSmith to generate my code template or class and keep my code snippet
http://www.ericjsmith.net/codesmith/
Ohh ..maybe need to try it again. Consider to shift the coming snippets to the database if I can connected to the server.
I'm building a very rebust component can handle all common routine that will be make my life easy for quite sometime, maybe the code library on the codeXchange will be help me to speedup.
Anyway thank for the information.
Not really ... Because I'm access throught the Proxy Server at my office, hereby is no Norton Firewall involve.
At home, I using Norton Firewall stop certain applications from gaining access to the net. so I can't disable it. Maybe I need to find out how to configure it manually.