Click here to Skip to main content
15,899,314 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i can't seem to make a textbox run a command for me in visual basic
in c# i would be able to do this easily but my program need vb to use it
so i cant use c#
and i don't know how to make the code for this
what i'm trying to do is when i type in words like commands and press enter the textbox would display in another textbox the commands and if i type in one of the commands in the textbox it will do the command and show the command you've done in the other textbox
thank you for your help

What I have tried:

I have tried various codes but none of them seem to work
Posted
Updated 28-Mar-18 13:29pm
v2
Comments
an0ther1 28-Mar-18 18:19pm    
What type of command are you talking about? If you are saying you want to execute a method, then a Select..Case statement should work for you - if the command is not an exact match then handle that in the Case Else statement.
If you are talking about running a command such as 'MyExecutable.exe' then you could use Process.Start().

Kind Regards

1 solution

You're question makes little sense.

A TextBox only displays and allows a user to edit text, nothing more. It provides no facility to "make [it] run a command".

So, what kind of command are you talking about? Are you saying it should run a command line, like in the Start -> Run box (Win-R)? Or are you taking about running some arbitrary method in your code? Or what?

Also, your reason for uising VB over C# is entirely arbitrary and has nothing to do with the code or it's ability to do this. VB.NET is just a verbose copy of C# without the curly braces and semi colons.
 
Share this answer
 
Comments
Member 13752095 30-Mar-18 10:47am    
My this i mean that if i type cmds the commands will show in another textbox. For example if a command is close and i type close and press enter then the program will close. That's what i mean
i couldnt explain it well before
Dave Kreskowiak 30-Mar-18 10:51am    
If you can do this so easily in C#, there is really no difference in the code between C# and VB.NET. The code is almost exactly the same, save for semantic differences. Take a short block of code and paste it into any online C#/VB.NET code converter and you'll see exactly what I mean.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900