Run program that is not in the same folder [closed] - vb.net

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need some help here, thanks, I am currently making a project in VB.net. What I want is that when you press a button, it will launch a program. So let's say that my program is called "test.exe" and the file is placed in "C:\Users\user\desktop\test.exe". How do I attach a code to a button that will RUN this program? Thankyou so much. Sorry if this is a bad question.

Use this code:
Public Sub Btn_Click(sender As Object, e As EventArgs) Handles someButton.Click
Process.Start("C:\Users\user\desktop\test.exe") 'You can also pass arguments by overloading this method like:
Process.Start("C:\Users\user\desktop\test.exe", "foo argument")
End Sub

use Process.Start("C:\Users\user\desktop\test.exe", "Arguments here")
UPDATE
if your main.exe is in xyz folder and your test.exe is in folder outside xyz say abc then use
Process.Start("xyz\..\abc\test.exe", "Arguments here")
This is relative path Note that both xyz and abc have same parent

Related

How can i make my own command to my first console application in VB.NET? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I'm doing my first VB.NET console application. I have some experience making VB.NET "non-console" applications.
My guestion is, how can i make my own commands to my console application. For example if user types to console "Hello World" and then the application would answer back to the user. I dont want it to be like "Press any key to continue..." nothing like that. I just want to make my own commands.
I've already tried to find some help from YouTube or Google but i couldn't find anything that would help even little. So i'm asking from you guys.
I also would like an answer soon as possible.
Console.ReadLine will block execution until the user has pressed the enter key. It then returns the full string of whatever the user typed on that line. You can then write conditional code which acts on whatever that returns. So, for instance:
Dim input As String = Console.ReadLine()
If input = "Hello World" Then
Console.WriteLine("Hello to you too")
End If

Type XXX is not defined in VB [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
The following are errors thrown by the code that comes below the error:
MIL.Html.HtmlDocument is not defined
Dim HTMLDoc As MIL.Html.HtmlDocument
MIL.Html.HtmlNodeCollection is not defined
Private Sub ParseHTMLDoc(ByVal Nodes As MIL.Html.HtmlNodeCollection)
HtmlNode is not defined
For Each Node As MIL.Html.HtmlNode In Nodes
Why am I getting these errors
MIL.Html looks like a third party class library(DLL). Have you imported or added reference of that dll in your project and imported the required namespace to your project? That should solve the problem.

VB.net Windows Language [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I make Program check language
Dim ln As String
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ln = System.Windows.Forms.InputLanguage.CurrentInputLanguage.LayoutName
If ln = "US" Then
Label1.Text = "English"
Else
Label1.Text = "Thai"
End If
End Sub
My program will check windows language but this program will check language itself not check windows.
Sorry My English bad.
Please help me.
According to http://msdn.microsoft.com/en-us/goglobal/bb688135.aspx, "Switching to a different input language is done on a per-thread basis; you can have two different input languages in two different applications." That's why you don't see changes made in Notepad - you're asking for the current thread's language, not Notepad's language.
Also, take a look at Detect system language change in WPF to see how to use events instead of polling with a timer.

What is the Bug in the below code? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have written
sub main ()
'some code goes here
end sub
This is the Module that I defined in the sheet1.And Yes I have only one workbook opened and in the userform1 I have given a command button Ok and when ok is pressed , The main function in sheet1 should be called
sub CommandButton1_Click()
call sheet1.main
end sub
I have tried these The problem Iam facing is , The code works sometimes and sometimes throws an error saying that an undefined object or not set with Occured.Why the code is working for sometimes and not for sometimes? Do i need to make any changes to make it work everytime ? Thank you in advance
The one thing I've found that makes my VBA programming easier is to always fully specify the object you're trying to manipulate (well, except maybe the top-level Application).
That means you should use something like Workbooks(0).Worksheets("Sheet1").main instead of relying on the active workbook.

Making a macro runs automatically in Outlook [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I wrote a macro in VBA that does an action on some of the files that arrive to my inbox in Outlook. However, I will have to click a button or a shortkey to run this macro. Is there a way that this macro runs automatically whenever an email arrives to my inbox?
Please help,
You should be able use an Outlook rule to run a script. Have a look at "Rules and Alerts" and creating custom rules.
Maybe this contains an answer to your question:
http://www.ureader.com/msg/1081942.aspx