By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,642 Members | 2,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,642 IT Pros & Developers. It's quick & easy.

compare text from clipboard

P: 13
I managed to get my text to the clipboard now I am trying to figure out how to compare it two different options. i know the goto is not good but I'm not sure a different way to do it.

If clipboard text = "this" then goto line 4
If clipboard text = "that then goto line 5
If clipboard text = "anything else" give error message box

Thanks for any input!

Happy New Years!!!
Jan 1 '08 #1
Share this Question
Share on Google+
5 Replies


lotus18
100+
P: 866
Hi

Can you explain to us in much more details (like goto line 4, ...) and what version of vb are you using.

Rey Sean
Jan 1 '08 #2

P: 13
vb 6 The line 4 and 5 are just examples i thought it a had a general idea i could fill in the blanks.
Jan 1 '08 #3

Expert 5K+
P: 8,434
I'd suggest something along these lines...

Expand|Select|Wrap|Line Numbers
  1. Dim strText As String
  2. strText = Clipboard.GetText
  3. Select Case strText
  4.   Case "this"
  5.     ' Do something
  6.   Case "that"
  7.     ' Do something else
  8.   Case Else
  9.     MsgBox "Dunno what that means."
  10. End Select
  11.  
Jan 1 '08 #4

P: 13
I'd suggest something along these lines...

Expand|Select|Wrap|Line Numbers
  1. Dim strText As String
  2. strText = Clipboard.GetText
  3. Select Case strText
  4.   Case "this"
  5.     ' Do something
  6.   Case "that"
  7.     ' Do something else
  8.   Case Else
  9.     MsgBox "Dunno what that means."
  10. End Select
  11.  
from what I understand the goto command is not good to use. Is the resume command proper to use?

Expand|Select|Wrap|Line Numbers
  1. Dim strText As String
  2. strText = Clipboard.GetText
  3. Select Case strText
  4.   Case "this"
  5.     ' Resume next 
  6.   Case "that"
  7.     ' Resume Line 23
  8.   Case Else
  9.     MsgBox "Dunno what that means."
  10. End Select
  11.  
Jan 1 '08 #5

Expert 5K+
P: 8,434
Resume is used to return from an error-handling routine. I doubt it's what you need here.

It's not that the Goto statement is bad as such, just that in any language that supports a decent code structure it should never be needed. It's generally seen as a symptom of lazy and poorly-structured code. Still works, though. :)
Jan 2 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.