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.
Related
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
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 4 years ago.
Improve this question
So I am completely new to creating software applications and I was wondering how to send users to a website when clicking a button. Like they do it in other software. I am using visual basic code (vb)
Do this (WPF):
Try
Mouse.OverrideCursor = Cursors.AppStarting
Process.Start("http://example.com/")
Finally
Mouse.OverrideCursor = Nothing
End Try
or this (WinForms):
Try
Dim temp = Me.Cursor
Me.Cursor = Cursors.WaitCursor
Process.Start("http://example.com/")
Finally
Me.Cursor = temp
End Try
Adapted from here:
http://faithlife.codes/blog/2008/01/using_processstart_to_link_to/
You can use the ShellExecute facilities for that (see this MSDN article for details).
basically what you do is call the Shell.ShellExecute and provide it with the URL you want to be opened - the OS will open it in currently configured default browser (which is a nice added bonus from the user interaction point of view)
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
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Hello everyone i'll keep it short and simple.
I want the app to determine if the current app (which is called "Managment") is on startup. If it is on the startup then do nothing.. if it isnt there put it on startup.
What is wrong with this? And is there any way without admin rights?
Dim app As String = My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True).GetValue("Management")
If app = Nothing Then
My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True).SetValue(Application.ProductName, Application.ExecutablePath)
End If
As mentioned in my comment, you are looking in the wrong place.
Using subKey As RegistryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
If subKey.GetValue("Management") <> Nothing Then
'It's there on start-up
Else
'Just add the key....
End If
End Using
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.