'************************************************************************************* '* Name: CS 100-01 * '* Program: Simple Calculator * '* Date: 4/22/03 * '* Description: This program changes an image based on an item selected by the user * '* from a list. * '************************************************************************************* Option Explicit Private Sub Form_Load() lstPieType.Clear lstPieType.AddItem "Pick a pie..." lstPieType.AddItem "Apple" lstPieType.AddItem "Cherry" lstPieType.AddItem "Peach" lblPieType.Caption = "Pie Picked!" End Sub Private Sub lstPieType_Click() Dim intIndex As Integer intIndex = lstPieType.ListIndex If (intIndex = 0) Then MsgBox "Pick a pie...", vbCritical, "Pie Error Message" ElseIf (intIndex = 1) Then imgPieType.Picture = LoadPicture(App.Path & "\ag00330_.gif") ElseIf (intIndex = 2) Then imgPieType.Picture = LoadPicture(App.Path & "\ag00331_.gif") ElseIf (intIndex = 3) Then imgPieType.Picture = LoadPicture(App.Path & "\ag00332_.gif") End If lblPieType.Caption = lstPieType.List(intIndex) End Sub Private Sub cmdExit_Click() End End Sub