|
Hello everyone.. how do you launch a MSWORD document in VB.NET, by code? Like if i want to open VB.doc. When I use the shell command, and then specify its path.. it will juz say 'File Not Found!'. It only launches executables.. I can't actually open the MSWORD file..
Can anyone help me out with this? Thanks in advance..
|
|
|
|
|
Process.Start(pathToDocFile)
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
Iam doing a project related to access control system.In this i have a click event where i have to launch an external application(for example application name FPM.exe).This is in the server in the network.My project is in the client machine.Now i have to launch this exe file on a click event, and when we close this fpm application we should be back in our project.How can i do this.If i can use shell command, then can anyone give me the exact syntax.?
Is it necessary to specify the path of this FPM.exe.is it possible for a coding which will search and find in the network for this file(rather than specifying the path) and launch that in my project.
Iam using vb.net (win based)
Hoping a help.
Thanks regards,
chepps
|
|
|
|
|
Funny, two questions iwth the same answer
Process.Start(filePath)
chepps wrote: Is it necessary to specify the path of this FPM.exe
Of course. Otherwise a typo would result in code that searched the entire hard drive
chepps wrote: is it possible for a coding which will search and find in the network for this file
You would have to write the code to do that seperately.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thank you Christian Graus
Regards,
Chepps
|
|
|
|
|
I am using VS2003, VB.NET, Windows2000+.
Is it possible?
Thank you.
|
|
|
|
|
If you're talking about limiting the usage of the CPU by your app, then globally no, it isn't possible. But, you can change the Priority[^] of any threads your app launches simply by giving it a new ThreadPriorty value.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have an application using .NET framework 1.1
Is it ask user to install if they don't have install .NET framework?
Please tell me if there is the way, Thank you.
|
|
|
|
|
Your installer should simply have it as a dependency. What installer do you use ? If they just copy an exe, it just plain won't run, there's nothing you can do about that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am fairly new to VB and I am stuck. I am not sure this is the best way to do this but what I am attempting to do is this.
I have a text file that has a lot of lines. I have the text file loaded into a variable "TextFileContent" and also the text properities of a text box "TextBox1" (Which is not visible). I am trying to search for a line in the variable "TextFileContent" and/or textbox "TextBox1" properities and change it to what the user has entered into another textbox "TextBox2". I need to search line by line and cannot figure out how to do this in a textbox or a variable or if it is even possible.
In that text file the first line is "StartLocation: Home".
The 2nd line is "EndLocation: Beach".
In "TextBox2" they will see the lines above ^ in the " ".
When they click the button "Change" I want it to grab the first line in "TextBox2" and search "TextBox1" or the variable "TextFileContent" and to change the line from what it is in "TextBox1" or the variable "TextFileContent"
to the line in "TextBox2". Then loop to the next line and repeat until it reaches the last line.
I am trying to do this in VB.
Any help is appreaciated.
Thanks.
-- modified at 5:34 Thursday 24th August, 2006
|
|
|
|
|
Use the replace function in VB. It will replace all occurances of a string within a string.
Example:
test = "This is a test"
testing = Replace(test, "is", "is not")
testing now equals: "This is not a test"
Mike Lasseter
|
|
|
|
|
Maybe I need to explain with better details.
I have a text document with about 200 lines.
for example here are some of the lines.
First Name: John
Last Name: Doe
State: CA
City: Hollywood
First Name: Jane
Last Name: Doe
State: GA
City: Atlanta
Now I have a load button and when I click the button this a open file dialog opens up and I select the file. Then it loops through and grabs the first and last names and puts them into a a drop down box. Then I select a certain person it it loop through until it finds that person and then will fill in the rest of the fields.
Like if I select John Doe in the drop down it will fill in the State textbox and the rest I have for that person. What I want to be able to do is if I click a save button it will search for the person and then reweite the line under neath that person.
From what I understand I should load the entire text file into a variable then search the variable line by line and change the text in the variable then write the entire variable back to the text document. I have no idea how to search the variable line by line so I tried to do thin in a hidden textbox and cant figure out how to search the textbox line by line.
I know how to do everything except search a variable ot textbox line by line. I know how to search a text file line by line and I am pretty sure it doesnt work the same for a textbox or variable.
If this makes no sense or you dont understand plase let me know.
|
|
|
|
|
I think I would do this a little different. Instead of using a variable I would create a People class that contained (first, last, state, city). I would parse the file into an array or collection of People. Doing this allows you to search through the list of people very easily.
Hope this helps.
Mike Lasseter
|
|
|
|
|
I'm not at very skilled VB programmer and quite new to Visual Studio 2005. I'm trying from an ordinary batch-script on windows to call a VB program, which - depending on the parameters - should set one environment variable.
I have managed to create the program, and I can see either through registry or through "Environment Variables" in "System properties", that my variable is created and set in either the user or machine environment. But in the command shell (cmd.exe) window I still have no access to the new environment variable.
I imagine the problem is that when launching the cmd.exe you take a kind of snapshot of the environment and works with this "copy".
But how can I refresh the environment so the variable is visible and the new value also?
Rgds.
Preben
|
|
|
|
|
Your looking for the Environment class and it's SetEnvironmentVariable method. Make sure that you pass EnvironmentVariableTarget.Machine for the third parameter and the system should get updated with the new variable. You can then launch a new CMD prompt to check if it worked.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi Dave.
Thanks for your reply, but it is exactly what I did. And it is true that you can see, and access the variable, when a new cmd.exe is spawned from as ex. "Run" in the start menu.
But if you call your program from the current cmd.exe shell, you can not see, nor access the variable from this shell, since it seems that you are in some kind of "static" environment, which is not renewed when the program is run.
Rgds,
Preben
|
|
|
|
|
OK, I see what you're doing now. No, there is no way to update the environment of a process from the "master environment" once that process has launched. You can update the environment and see the changes, but not using the EnvironmentVariableTarget.Machine . You have to change that to read EnvironmentVariableTarget.Process .
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi Guys,
I'm developing a small dll in vb2005 to handle my app licensing.
Based on requirements put forward by my, god bless him, supervisor I need to retrieve the processor and HD serials and use those to authenticate product installations.
I know that's an ugly way of doing things but considering that most if not all CD protection software out there are cracked and a simple serial/activation key system can be easily abused I'm not protesting this too much.
Anyway, I got the basic functions to retrieve the serials and handle encryption/decryption thanks to an excellent post by Tomy Emden (http://www.codeproject.com/useritems/Crypto.asp[^]).
My main problem now is when i run this app to test serial retrieval, on other PC's, I get a security message with a lot of nonsense about required admin authorisation and .NET config tools etc. The message box also got lots of details along the lines of: System.Security.SecurityException: That assembly does not allow partially trusted callers.
So my question is from the security and permissions standpoint what must I have or do in order to get the info I need with minimal hassle for the end user.
Is there some code that needs to be included in order to bypass this sort of messages (non-malicious code of course )?
Do you I need certificates etc.?
Basically if some one could push me in the right direction or explain the things I need to consider I would really appreciate it.
Regards
Alex
BTW: Thanks for reading this long ass post!
The perfect code is always in your head...it just a matter of how hard you bang your head against the wall to get it out!
|
|
|
|
|
I had to do the same thing recently and I settled on the volume serial no ( which will change on a reformat, but at least doesn't need admin rights to access )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Christian
To be honest I wanted to settle for this myself but then again that increases the 'hassle factor'. From my experience customers reformat drives more often that they change them let alone change part of the system.
Besides using just a volume serial gives you one point of reference whereas proc mobo ram and HD manufacturer assigned serials give you a way of reducing headaches. Say only 2 out of 4 match the app can still function.
I could put admin rights as a requirement for the app but that option is reserved for when I hit the rock bottom and dig into 50 feet of crap .
I appreciate your response but still would like to get more info on this issue.
The perfect code is always in your head...it just a matter of how hard you bang your head against the wall to get it out!
|
|
|
|
|
Yes, I have to admit that I wanted to go the HDD serial route, but I couldn't find a way to make it happen, and our needs were somewhat specific, such that the compromises you mention were regarded as being not a problem.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Christian,
I played with the .net settings and tools and then read stuff from here (www.informit.com[^]) and there (msdn.microsoft.com[^]) and it all became clear as mud .
The reason my test app didn't function was because it was run from the server (ie permission set Intranet) hence the ugly security exceptions. However, the actual application is intended to be run locally thus requiring the user to be an admin on the local pc is not that much to ask considering that the application my app extends has that requirement anyway.
Once again thanks for your time Christian
Regards
Alex
The perfect code is always in your head...it just a matter of how hard you bang your head against the wall to get it out!
|
|
|
|
|
Hi
How can i edit the legend of the graph in the crystal report.
I cant find any option for the same
Please Help me.
Thanx
Riyaz Zujer Patanwala
I.T.Programmer
Al Jaber Energy Services
P.O.Box 47467
Abu Dhabi
U.A.E.
|
|
|
|
|
I have an MDI form where I set the following Handler in Form_Load
AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf CurrentDomain_UnhandledException
If I throw an exception in the MDI form the exception gets handled by CurrentDomain_UnhandledException
But, If I load a child form and throw an exception from the child form the excpetion does not get handled by CurrentDomain_UnhandledException
So, Is the child form running in a different AppDomain then the MDI form. How can I get this to work or does this not work the way I thought it would.
Here is my form load which is also in the MDI form
f = New formDesignErrorsList<br />
f.Tag = formname<br />
f.Text = f.Text<br />
f.MdiParent = Me<br />
f.Show()
Thanks
-- modified at 22:46 Wednesday 23rd August, 2006
|
|
|
|
|
mtone wrote: Is the child form running in a different AppDomain then the MDI form.
No, it's not. It's all in the same AppDomain.
What's the exception that's not getting handled?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|