473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

compare text from clipboard

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
5 1566
lotus18
866 512MB
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
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
Killer42
8,435 Expert 8TB
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
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
Killer42
8,435 Expert 8TB
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

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

Similar topics

2
by: Rich Sweeny | last post by:
Hi, I have a program that is being used on Mac's and PC's. The Mac's are running OSX. The user can copy and paste text from the clipboard into a JTextArea which is part of a form. Sometimes when...
4
by: Risto Heinonen | last post by:
Hi. I have a web page that has images and text. I can carefully select one image and the on the right of the image and then copy & paste to Word. Is it possible to make javascript do the same:...
2
by: Coder | last post by:
Hi, I wanted to know of a way that I can put text into the Office (Outlook/Word) clipboard from Internet Explorer. So when a user a user clicks on a button, some text is placed into the...
7
by: William Gill | last post by:
Is there a simple way to cut and paste from a tkinter text widget to an entry widget? I know I could create a mouse button event that triggers a popup (message widget) prompting for cut/paste in...
2
by: David Dvali | last post by:
How can I cut/copy/paste text from/into textbox using clipboard from my code?
1
by: dananrg | last post by:
Can you tell I miss Unix? I want to write a Python script that, when launched, will choose a random .sig (from a list of about 30 cool ones I've devised), and store the .sig text in the Windows...
4
by: ACF | last post by:
Hello, I'm programming an application in MS Access 2003 / 2007 and would like to know how I can copy highlighted text to the windows clipboard? I am now using a statement in combination with...
9
by: Neil | last post by:
Anyone have any idea why SendMessage ctl.hwnd, WM_PASTE, 0, 0 isn't working from a regular Access text box (form is opened normally, not in dialog more)? I realize I can just use...
8
by: kroogar | last post by:
Hi gurus .Net 2.0 I'm on a project where I need to be able to detect if my clipboard contains BOTH images AND text (eg. when copying from a web page). For some reason...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.