Vb.Net Startup Determination [closed] - vb.net

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

Related

'The "ResolveComReference" task returned false but did not log an error' after update Windows 10 [closed]

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 2 years ago.
Improve this question
After an update of windows, I get the error message during build in one of the projects.
I have tried to update all third party references without success.
Google betrays me with nothing to use to solve the problem
Someone who can give a clue what happened?
I found the cause of the error in a com library that has remained after some experiment before.
Library "MSHTML" (COM component)
When I removed the reference, the builde worked again

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

Microsoft Visual Studio | Redirect users to a website from clicking a button inside the software [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 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)

Form disappears when trying to create a shortcut VB.NET [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
When my code reaches the Dim MyShortcut... line the form disappears, no exception no windows error reporting the form just vanishes with the process still running.
Friend Sub CreateShortcut(Location As String, Target As String)
Dim MyShortcut As IWshRuntimeLibrary.IWshShortcut = CType((New IWshRuntimeLibrary.WshShellClass).CreateShortcut(Location), IWshRuntimeLibrary.IWshShortcut)
MyShortcut.TargetPath = Target
MyShortcut.Save()
End Sub
Please ask if you need any more details. I wasn't sure what could be causing the issue so didn't know what else to add.
Thanks in advance!!

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.