![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Aug 2005
Location: Norway
Posts: 56
Rep Power: 0
![]() |
Problems with Rich Textbox.
Hi!
I try to make a program in Visual Basic. Just for fun. This program is like the command line in Windows. There is one textbox, Rich Textbox and one command button. If you write help, it should come up a list of commands i can use in the program. I wrote this: If txtCommandLine = "help" Then rtfConsole.Text = "Some text" Etc... End If It's my code bad?
__________________
Heh. |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Aug 2005
Posts: 6
Rep Power: 0
![]() |
try having your code say txtCommandLine.text instead of just txtcommandline
also another thing could be that the case of the text isn't the same. I would change your code to be something like this: make sure that when you use the lcase$ command that your text that it is compairing it to is in lowercase If lcase$(txtCommandLine.text) = "help" Then rtfConsole.Text = "Some text" Etc... End If Also if you have multiple commands i would suggest using a select case type setup instead. Select case lcase$(txtcommandline.text) case "help": 'whatever you would do when they type help case "anothercommand": ' whatever you would do when they type anothercommand end select |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Aug 2005
Location: Norway
Posts: 56
Rep Power: 0
![]() |
Ok! I'll try.
__________________
Heh. |
|
|
|
|
|
#4 |
|
Expert Programmer
|
If you use the split() and trim() functions appropriately you could also deal with whitespace and command parameters. Also using strcomp(a,b,vbTextCompare) or Select Case Ucase(something) will add case-insensitivity.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|