• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Visual Basic Help

syker

New Member
Joined
Sep 25, 2007
Messages
83 (0.01/day)
what is the code to open a program from the mouse-click of a button? i have tried a few different codes, but none of them seem to be working.
 
Insert the following function:

Shell(<enter file path of program>,<Window State of program to be opened>)

Example:

Shell ("C:/Notepad.exe",vbmaximized)
 
Right-click, as far as I know, always triggers the associated ContextMenuStrip. Whatever control you are right-clicking on therefore needs a ContextMenuStrip assigned to its .ContextMenuStrip or .ContextMenu property. You'll most likely have to have a button in that ContextMenuStrip which, when clicked, executes your program.

As for launching programs, first you need "Imports System.Diagnostics" (no quotes) at the top of the .vb file. To start it, do Process.Start(path, arguments) or...

Code:
Dim psi As New ProcessStartInfo(path, arguments)
With psi
  .ShellExecute = false
  .CreateNoWindow = true
  .etc
End With
Process.Start(psi)
Process has a lot of goodies in it so you might want to store the result of start in a variable for use later.
 
Insert the following function:

Shell(<enter file path of program>,<Window State of program to be opened>)

Example:

Shell ("C:/Notepad.exe",vbmaximized)

when you say "Window State of program to be opened" what specifically do you mean?
your example said "vbmaximized". Notepad isnt Visual Basic, so what does the "vb" mean?

i am not second-guessing your ability to give good codes, just making sure that everything is secure and this code won't blow up in my face.
 
when you say "Window State of program to be opened" what specifically do you mean?
your example said "vbmaximized". Notepad isnt Visual Basic, so what does the "vb" mean?

i am not second-guessing your ability to give good codes, just making sure that everything is secure and this code won't blow up in my face.

I never typed that :wtf: I think my friend must have seen that post and proceeded to help you out :ohwell: I am sorry I am of no help when it comes to Visual Basic :o I think he refers to either full screen or just a small window. I have no idea what he means by the phrase "vbmaximised". Will come to you if I meet him again.

Edit: He says that it refers to the initial state of the window, ie maximised or minimised (in the taskbar). The "vb" is just the code.
 
I never typed that :wtf: I think my friend must have seen that post and proceeded to help you out :ohwell: I am sorry I am of no help when it comes to Visual Basic :o I think he refers to either full screen or just a small window. I have no idea what he means by the phrase "vbmaximised". Will come to you if I meet him again.

Edit: He says that it refers to the initial state of the window, ie maximised or minimised (in the taskbar). The "vb" is just the code.

well, it worked, nevertheless. so thank him for me when you get the chance.
 
another question: what is an easy, affordable (preferrably free), way to convert VB10 to EXE? i already tried iexpress.exe but it didnt quite work.
 
Last edited:
Doubt there is a way. VBS is based on VB6--both of which are incompatible with Visual Basic .NET (7-10). VBS generally needs to be reprogrammed into VB.NET.


Edit: Maybe you can run them directly with the code I posted before. For example:

System.Diagnostics.Process.Start("C:\oldvbscript.vbs")
 
ok, i found out a way. under "Project" you will find a drop-down item called "Publish <name of document>". click that, then click "finish" on the first page of the popup. then you have a home-made program that you can put on your desktop.
 
Oh, VB10. You can build it by right-clicking on the project and selecting Build or you can do the same by going to the Build menu up at the top. Running the app also often triggers a build. Whenever it builds, you can find the finished product in <Project Name>\bin\<Configuration>\<Assembly Name>.exe or .dll

For example, if your project name is "Foo", you did a Debug build, and the Assembly Name is "FooBar", the path to the executable would be:

Foo\bin\Debug\FooBar.exe
 
Back
Top