• Creator
    Topic
  • #4095
    Anonymous

    Hi everyone. I am new to Formativ and I have a question regarding combo boxes. I have developed applications in Access and when I have a combo box on a form, I can put an after update procedure on the combo box. I would like to do the same thing with a combo box I added to a form. Basically what I hope to accomplish is to have a combo box with a list of room setups. I would then like to have one image area on the form. After a room setup is chosen from the combo box, I would like the image area to reflect the choice from the combo box. For example, if I choose “Yoga” from the room setup combo box, I would like the image area to show the “yoga” bitmap file I have saved.

    Also, if an after update procedure wouldn’t work, I thought about a select statement.

    Any help would be Greatly appreciated! Smile

  • Author
    Replies
  • #7082
    Support 1a
    Participant

    Thank you for your post.

    You would normally use the OnChange event of the combobox control to do this. I created a simple applet with a form call test that contained a combobox called cbMain. I loaded the combo with three items.

    I then associated an event with the OnChange event, and wrote some code to display a message box that shows the ItemIndex of the newly selected item. The first item in the combo has an index of 0, the second 1, etc. You could use this value to load the appropriate image file from disk into an image control.

    Heres the code:

    Sub Main(Client, GWEvent)
       test.showmodal
    End Sub
    
    Sub cbMainChange(Sender)
       MsgBox "Load the image for: " + CStr(test.cbMain.ItemIndex),0,"On Change"
    End Sub

    I hope this helps. Let me know if you require any further assistance.

    Regards,

    Advansys Support

    #7081
    CLKurutz
    Participant

    THANK YOU very much for your input. I was able to take your coding/description and added the following code to get it working.

    If ActivityRoomTest.RoomSetup.itemindex = 0 then
    ActivityRoomTest.RoomSetupImage.Picture.LoadFromFile(“d:fvshgroupwise customviewsactivity roomregularactivity.bmp”)
    End If
    If ActivityRoomTest.RoomSetup.itemindex = 1 then
    ActivityRoomTest.RoomSetupImage.Picture.LoadFromFile(“d:fvshgroupwise customviewsactivity roomyoga2.bmp”)
    End If

    It works great. Thanks again.

    #7083
    Support 1a
    Participant

    Glad to help. Please let us know if you require further assistance.

    Regards,

    Advansys Support

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.