+ Reply to Thread
Results 1 to 2 of 2

Thread: Userform - Picture inserted into image1 control based on what is populated into t

  1. #1
    Registered User
    Join Date
    10-24-2010
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    1

    Userform - Picture inserted into image1 control based on what is populated into t

    I am in the same boat http://www.excelforum.com/excel-prog...print-out.html hard to find what you are looking for but i found this your textbox6
    could be Textbox1 and combo box textbox2
    I have not got it to work yet..only the picture designated to be there if nothing else is
    anyway if you get it working please post as i am still looking
    thanks john

    Assume you have an image control on the userform named Image1
    Private Sub Textbox1_Exit()
      
    if lcase(me.Textbox1.Value) = "yes" and _
         lcase(me.Textbox2.Value) = "yes" then
         
     me.Image1.Picture = LoadPicture("C:\MyPics\checkmark.jpg")
      
    elseif len(trim(Textbox1.Value)) > 0 and _
             len(trim(Textbox2.Value)) > 0  then
           
    me.Image1.Picture = LoadPicture("C:\MyPics\Cross.jpg")
      
    else
           ' do nothing until there is a value in each textbox
      end if
    end sub
    
    Private Sub Textbox2_Exit()
      
    if lcase(me.Textbox1.Value) = "yes" and _
         lcase(me.Textbox2.Value) = "yes" then
          
    me.Image1.Picture = LoadPicture("C:\MyPics\checkmark.jpg")
      
    elseif len(trim(Textbox1.Value)) > 0 and _
             len(trim(Textbox2.Value)) > 0  then
          
     me.Image1.Picture = LoadPicture("C:\MyPics\Cross.jpg")
      
    else
           ' do nothing until there is a value in each textbox or
           ' me.Image1.Picture = LoadPicture("C:\MyPics\Cross.jpg")
      
    end if
    
    end sub
    I used the exit event of each textbox to trigger the code. You may want to use something else - that's up to you.

    --
    Regards,
    Tom Ogilvy
    Last edited by Leith Ross; 10-24-2010 at 04:34 PM.

  2. #2
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,639

    Re: Userform - Picture inserted into image1 control based on what is populated into t

    What's the question?

    Shorten your title as well, currently it makes no sense
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0