Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 7th, 2005, 3:07 PM   #1
mikaoj
Programmer
 
mikaoj's Avatar
 
Join Date: Aug 2005
Location: Norway
Posts: 56
Rep Power: 0 mikaoj is an unknown quantity at this point
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
But, when I try to run the program and write help. Nothing happends.
It's my code bad?
__________________
Heh.
mikaoj is offline   Reply With Quote
Old Aug 11th, 2005, 1:56 PM   #2
BrianN
Newbie
 
Join Date: Aug 2005
Posts: 6
Rep Power: 0 BrianN is on a distinguished road
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
BrianN is offline   Reply With Quote
Old Aug 12th, 2005, 11:38 AM   #3
mikaoj
Programmer
 
mikaoj's Avatar
 
Join Date: Aug 2005
Location: Norway
Posts: 56
Rep Power: 0 mikaoj is an unknown quantity at this point
Ok! I'll try.
__________________
Heh.
mikaoj is offline   Reply With Quote
Old Sep 7th, 2005, 2:12 PM   #4
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
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.
Rory is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:35 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC