CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2001
    Location
    Cambridgeshire, England
    Posts
    8

    inserting .gif image

    i have a form with a text box on and would like to insert an image into it providing that the correct 4 digit number is typed in to the same textbox to start with. if the wrong 4 digit number is typed in, a msgbox to appear with a msg to say so, please help as this is very frustrating for a beginner like myself
    thanx in advance


    Thanks in advance for any help in this matter

  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: inserting .gif image

    You can do this using a richtextbox control. Regular textboxes do not allow you to insert objects.

    private Sub RichTextBox1_Change()

    If len(RichTextBox1.Text) = 4 then
    If Left(RichTextBox1.Text, 4) = "1234" then
    RichTextBox1.SelStart = 0
    RichTextBox1.SelLength = 4
    RichTextBox1.OLEObjects.Add Source:="c:\1234.bmp"
    RichTextBox1.SelStart = 1
    End If
    End If

    End Sub




    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Aug 2001
    Location
    Cambridgeshire, England
    Posts
    8

    Re: inserting .gif image

    Thanx for the solution, but there is only one snag, i don't think i can use a richtextbox control in access 97 which is the application that i am using for the rest of my project.
    is there a way i can manipulate it for use with access?


    Thanks in advance for any help in this matter

  4. #4
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: inserting .gif image

    You can use the richtextbox control in Access

    On your workset (the thing with all the controls on), there's a button called 'more controls', when you press this, a list will pop up. Scrool down until you get to 'Microsoft Rich Textbox', select it, and drag it into the form

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  5. #5
    Join Date
    Aug 2001
    Location
    Cambridgeshire, England
    Posts
    8

    Re: inserting .gif image

    so obvious when someone tells you, thanks very much for your help



    Thanks in advance for any help in this matter

  6. #6
    Join Date
    Jul 1999
    Posts
    8

    Re: inserting .gif image

    I got a question on adding OLEObjects. When I do the following,
    RichTextBox1.OLEObjects.Add Source:="c:\1234.bmp"
    I got a shaking of the user interface and I can't
    figure it why and can't figure a way to avoid it.

    Any suggestions?

    Thanks

    Alex Zhu


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured