DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: VB 6, Clipboard.GetText NOT working

  1. #1
    Join Date
    Jul 2004
    Location
    St. Louis, Mo
    Posts
    111

    VB 6, Clipboard.GetText NOT working

    I cleared the Clipboard and proved it was blank because, when I paste it manually to the NotePad, nothing appears.

    Then I ran my program and stopped after simulating the CTRL-C and
    I can manually paste the "30" to the NotePad.
    Therefore, I have the string in the Clipboard.

    But, when I run the program and continue with the following code, the Textbox remains empty!

    '-------------------
    FxFormWebBrowser.SetFocus
    Info.SelText = Clipboard.GetText(vbCFText) '=1 default
    If Info <> "30" Then ....

    If Mid(Info, 1, 2) <> "30" Then .... 'also does not work
    '-------------------

    Info is a TextBox on FxFormWebBrowser.
    I can read/write to Info elsewhere in this same Subroutine.
    I have also tied: vbCFRTF for Rich text Format.
    I have searched the net & Microsoft and found no solutions, they all indicate that I am doing this correctly.

    Any suggestions?

    'Good software like good food takes time to prepare.'

    Winnie-the-Pough

  2. #2
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    What happens if you use the .Text property instead of the .SelText Because after that you compare the content of the TextBox, I think .Text is what you should use
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  3. #3
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    45
    For me sometimes when VB starts it clears the clipboard (don't know why)
    Your code is correct, I tested it and it works.
    When you execute your code be sure there is something on the clipboard. You can use this:
    Code:
    Clipboard.GetFormat(1)'Where 1 is for the text
    The value returned should be True if not there is no text on the clipboard. (maybe something cleared it before)
    A think you can also do is to place a breakpoint and view all the things step-by-step (it's easier to find where exactly is the problem)

  4. #4
    Join Date
    Jul 2004
    Location
    St. Louis, Mo
    Posts
    111
    Thanks

    I got it to work using:
    Mid(CInt(Info), 1, 2)<> 30

    Apparently there was some hidden characters.

    Winnie-the-Pough

  5. #5
    Join Date
    Feb 2004
    Location
    Sydney, Australia
    Posts
    498
    Glad you got it working.

    P.S. 'Winnie the pooh' [according to A. A. Milne] (unless you guys have either (1) another meaning ... or (2) another spelling ???

    :-)

Similar Threads

  1. MMFAN Retires
    By MMFAN in forum .NET
    Replies: 20
    Last Post: 09-22-2002, 11:54 PM
  2. Interesting Infoworld Articles
    By Greg Brunet in forum .NET
    Replies: 48
    Last Post: 08-12-2002, 10:12 PM
  3. They created J#, why couldn't they do VB#?
    By Thomas Eyde in forum .NET
    Replies: 290
    Last Post: 12-22-2001, 03:13 PM
  4. VB Mutex WaitForSingleObject not working
    By Ryan Parmenter in forum VB Classic
    Replies: 0
    Last Post: 12-03-2001, 11:42 AM
  5. Self-Interest & VS.NET
    By Zane Thomas in forum .NET
    Replies: 147
    Last Post: 01-31-2001, 02:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center