Visual Basic Command Protocol

Hello, I am currently writing an improved, aesthetically and practically, clone of MS-DOS. You might have seen another post about the same subject by Kgenis, as we are both working on it together, only difference is I only started learning VB last night... well here goes.

We currently have a few commands scripted that use two arguements, such as "Rm Driveletter\Path.to.file" then VB checks executes the DelTree command followed by the specified file. But now we need to make another set of commands that use just one arguement, such as a 'HELP' command that prints all the commands and there uses or a 'logoff' command, that logs the current user off the computer.

In summary:
The user types a command, e.g. 'help' into the texbox.
VB then takes this command and executes what we want it to do, in this case, using AddLine to print all of the commands and there uses to the screen.

Matt is not currently around so I can't contact him on the issue, and I would like it done by tomorrw, so any help is greatly appreciated. I appologise for the small amount of available points to hand out.

Regards, Ross
LVL 1
SirRossAsked:
Who is Participating?
 
DarkoLordCommented:
0
 
DarkoLordCommented:
Hope this helps:


Option Compare Text 'add this line to the top

Sub Command1_Click()
   Dim strTmp As String, arrStr() As String
   strTmp = Text1.Text
   arrStr = Split(strTmp, " ")
   Select Case arrStr(0)
      Case "help"
         PrintHelpToScreen
      Case "logoff"
         CallCodeToLogoffUser
      Case "rm"
         RemoveFolder arrStr(1)
   End Selecr
End Sub
0
 
SirRossAuthor Commented:
Hmm... here is an image of how we have created this, it might help on the replies.

www.empirical-island.co.uk/images/os_prompt.gif

Here is a link to some of the current source:

http://rafb.net/paste/results/qTMrJ880.html

All help is much appreciated, thank you.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
DarkoLordCommented:
Well it should work if you comment (add ' before it) this line:

If Len(tmpArgument) = 0 Then GoTo Err

Darko
0
 
SirRossAuthor Commented:
No that doesn't work...

It also needs that in for it too work, there needs to be a second function or something that checks to see if help or other single arguement commands are typed and deals with them appropriately.
0
 
DarkoLordCommented:
Okay, try this then:


Sub Command1_Click()
   Dim strTmp As String, arrStr() As String
   strTmp = Text1.Text
   arrStr = Split(strTmp, " ")
   Select Case Ubound(arrStr)
      Case 0
         'nothing
      Case 1
         '1 argument
      Case Else
        'more arguments
   End Select
End Sub
0
 
SirRossAuthor Commented:
Hmm.... I'm afraid that won't work either, we are still looking for answers, but our anti-crack devices and such activated when i installed some new hardware that changed my internal info, so I corrupted the data. We have backups but we have to remake the forms.
0
 
DarkoLordCommented:
Well ALL three solutions work (if you know where to put them), so please be more specific...

Darko
0
 
SirRossAuthor Commented:
From the source code displayed at this link:

http://rafb.net/paste/results/qTMrJ880.html

Can you please inform me of where to put them, either by posting it here, or using:

http://rafb.net/paste/

To upload it.

Many thanks in advance.
 - Ross
0
 
SirRossAuthor Commented:
Thanks You. :) Its really helpfull. I'm glad I finally got it done.
0
 
DarkoLordCommented:
You're welcome

Darko
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.