473,809 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

compare text from clipboard

13 New Member
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 1583
lotus18
866 Contributor
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
countryboy
13 New Member
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 Recognized Expert Expert
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
countryboy
13 New Member
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 Recognized Expert Expert
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
3455
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 the text comes from the clipboard there is a hollow box at the end. This box cannot be selected. I am using the DecodeXML and EncodeXML methods to save files to disk until the user decides to save the files to a database. When these files are...
4
32294
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: select the same area (divided by <div> tag) and copy to clipboard? So far I succeeded to make the script to copy the area inside <div> but it was plain html-text.
2
5484
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 clipboard. Ive tried this, but no luck.
7
18044
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 each of the widgets using a temp variable to hold the text, but I don't wnat to reinvent the wheel if there already is something that does the job. Thanks, Bill
2
19049
by: David Dvali | last post by:
How can I cut/copy/paste text from/into textbox using clipboard from my code?
1
1773
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 Clipboard, so I can then paste it into any Windows application. This way, it'll work for Outlook e-mails, Yahoo, Gmail, etc. Also, could I use Python to programmatically set key combos to do
4
10392
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 module "Call ClipBoard_SetData(Memo)" but this copies the whole 'memo' field. I want to highlight text in the memo field and copy only that text to the clipboard. What I really want is the VBA code for window's to copy selected text to the...
9
4716
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 docmd.RunCommand acCmdPaste. But I have a reason for needing to do it this way. When I run the code I get the message, "Object doesn't support this property or method" (error 438). Any ideas why this is happening? Thanks!
8
8095
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 Clipboard.ContainsImage() only returns true if the clipboard contains one and only one image. I use Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) to detect the presence of text. What I need to figure out is how to detect if the clipboard contains one or...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10637
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7660
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3014
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.