string - how to add parameters to a custom command vb.net -
is a function that is converting string to hex. It's ok to work with a text box and a button but my project has a console form and output is in the form of a rich text box and a textbox inbox, users have to type the command and execute the order press enter.
I am trying to create: hex "string" here is the current state of the inputbox code:
personal sub-consoleinputbox_KeyDown (object as the sender, and KeyEventArgs) handle consoleinputbox.KeyDown as the slow command in the string = console input box. Text if e Cacode = key Then A. SuppressKeyPress = True Output Command (Command) End If End Sub Output Function Adding Text to Rich Textbox The CallCommand function is like this:
public function calls command (as string) dim as ss = s.ToLower () ss = ss.Trim Choose episode ss episode "cls" GetRtb.rtb.Clear () Episode "Help cls" GetRtb.rtb.AppendText ("Obviusly clear your console screen ..." & amp; vbCrLf) Return true episode "Ping" GetRtb.rtb.AppendText ("Upgrade For more information type help ping .... "& amp; vbCrLf) Return True Case" Help Ping "GetRtb.rtb.AppendText (" Usage: Ping [Hostname or IP] "& amp; vbCrLf) Revert to Actual Case "Help" GetRtb.rtb.AppendText ("Available Command:" & vbCrLf) GetRtb.rtb.AppendText (Available Commands) Returns True Case Else GetRtb.rtb. Change the end function ("bad command or filename ..." and VBCRLF) Select the false ending How can I check the console inputboxes if there is an empty space and If there is empty space, can I separate the word as command and rest as a parameter? As you can see "ping www.me.com" or "hex adadad" thank you!
I think this problem has been solved but if I need more parameters then I More functions like call command 2, etc. ... Input box code:
Personal sub-consonantto box_adidown (as the sender, and KAVENT as ARG) handles consoleinputbox.KeyDown then e.KeyCode = Keys.Enter then e.SuppressKeyPress = String = consoleinputbox.Text slow command string (true) as command = text.S Plit ("") then Command.Length = 1 then text.Trim () output (text) call command (command (0)) Other commands. Length = 2 then output (text) callcom 1 (command (0), command (1)) end and end and end and the rest of the module;
Public sub-production (such as a string) if the S & lt; & Gt; "GetRtb.rtb.AppendText (s & vbCrLf) GetTb.tb.Clear () GetTb.tb.Focus () end if ending COPY function CallCommand (string as c1) c1.ToLower () Episode C1 Select" CLS "GetRtb.rtb.Clear () case" Help "output avaliablecommands call (avaliablecommands) Episode" hex "output (" use insufficent parameters: help hex ") episode" ascii "output (" insufficent standards Use: Assistance ASI ") case other output (" bad command or filename ... ") and return returns True End Function Public Function CallCommand1 (String like c1 C1.ToLower (c2) Select c1 Case "Help" help_par (P2) Episode "Hex" hex_par (P2) Episode "ascii" ascii_par (P2) Select the end of the return Selection of the case of "Ping" output ("Usage: Ping [Host name or IP"]) Episode "cls" output ("Obviusly clears the console to you." The case of true termination function function help_par (as P string) .. ") episode" hex "output (" string code converts to hexcimal: hex & lt; String & gt; "Episode" ascii "output (" hexcimal code converts to string. Use: ascii ") select end result and end function function hex_pr string form string as string stroke = hexcode (p) output (STH) return and end function function ASCI_ (string as P) string = hextoresring (P) output (toastring) returns and functional public all available command () output ("help, C Ls, ping, hex, asci ") and all and module
im requires programming to be very new. Ideas are needed.
Comments
Post a Comment