Pioctures dependant on text box result

Sgt Bilkp

Registered User.
Local time
Today, 05:26
Joined
Jan 11, 2008
Messages
66
Hi, is it possible (at all) to have a small range of images (whatever format is best) on a Form, which only appears dependent on the contents of a Text Box?

frmMain_data is the form, and the text box is txtType which holds a range of 1-3.

Depending on the result i want an image to appear on the form (image1-3.gif/jpg).
 
Insert the pictures and place them anywhere on the form you would like. Using VB code set the properties of the picture's visible attribute to true or false depending on when you would like it visible.
DeWayne
 
Any suggestions on the VB code?
 
I would stack them on top of each other and then write something like

Code:
Select Case txtType
Case Value1
Me.image1.visible = true
Me.image2.visible=false
Me.image3.visible=false

Case Value2
Me.image1.visible = false
Me.image2.visible=true
Me.image3.visible=false

Case Value3
Me.image1.visible = False
Me.image2.visible=false
Me.image3.visible=true

End Select
 
Would the code have to be on an event update, or on open? Would it also have to be added to each picture?
 
The code would go whenever you would like the pictures to change. If you want them to change whenever the textbox is messed with, you could put it in the Change event.
 
The code would go whenever you would like the pictures to change. If you want them to change whenever the textbox is messed with, you could put it in the Change event.

Don't seem to have On Change event in the properties on the pictures?
 
You can add the code to the text box's After Update event, to capture changes from the text box, and also possibly to the form's On Current event to make the change as you move from record to record.
 
The change event is for the text box. You can change whether or not the pictures are visible from within the text box's change event.

**Go with Bob's suggestions. Not only does he type faster than me, but he also knows quite a bit more! ;-)
 
The change event is for the text box. You can change whether or not the pictures are visible from within the text box's change event.

Yeah, I wouldn't put much of anything on the change event of the text box as that can slow things down considerably, depending on what you are doing. It fires for every keystroke and that could be overkill.
 
Thanks Bob. I couldn't find the option for the On Current Event, so i tried it in Moise Move which works but continually refreshes obviously. Any tips on how to find On Current Event?
 
Select the FORM itself by selecting via the gray area outside of the detail section, or selecting from the drop down that is on the properties dialog or on the toolbar. Then you should see it listed.
 
Yeah, I wouldn't put much of anything on the change event of the text box as that can slow things down considerably, depending on what you are doing. It fires for every keystroke and that could be overkill.

Thanks for the tip. I didn't realize it fired after every keystroke. I've only ever used the change event for a combo box, but it makes sense that it wouldn't be the same for a text box.
 

Users who are viewing this thread

Back
Top Bottom