Solved

Visual Basic Command Protocol

Posted on 2004-08-25
11
154 Views
Last Modified: 2013-11-25
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
0
Comment
Question by:SirRoss
  • 6
  • 5
11 Comments
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11898586
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
 
LVL 1

Author Comment

by:SirRoss
ID: 11898751
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
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11898833
Well it should work if you comment (add ' before it) this line:

If Len(tmpArgument) = 0 Then GoTo Err

Darko
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 1

Author Comment

by:SirRoss
ID: 11898884
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
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11901531
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
 
LVL 1

Author Comment

by:SirRoss
ID: 11907215
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
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11907918
Well ALL three solutions work (if you know where to put them), so please be more specific...

Darko
0
 
LVL 1

Author Comment

by:SirRoss
ID: 11908782
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
 
LVL 22

Accepted Solution

by:
DarkoLord earned 200 total points
ID: 11911025
0
 
LVL 1

Author Comment

by:SirRoss
ID: 11911544
Thanks You. :) Its really helpfull. I'm glad I finally got it done.
0
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11915297
You're welcome

Darko
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question