Hello!

I'm developing a Wizard-style application, but I'm not using the "VB Wizard Manager" type of program because I need to explicitly manage which page is shown next based on what the current page is as well as user input. I have a "currPic" variable that keeps track of which page (PictureBox) is currently shown.

In my cmdNext_Click method, I have a Select Case statement that switches on the value of "currPic", and is supposed to show the next page depending on what the current page is. Here is a small example:

Code:
Option Explicit

Private currPic As PictureBox

Private Sub Command1_Click()
    
    If currPic Is Nothing Then
        Set currPic = pic1
    End If
    
    Select Case currPic
        
        Case pic1
            Debug.Print "currPic = pic1"
            Set currPic = pic2
        Case pic2
            Debug.Print "currPic = pic2"
            Set currPic = pic3
        Case pic3
            Debug.Print "currPic = pic3"
    
        Case Else
            Debug.Print "currPic not set: " & currPic
            
    End Select
    
End Sub
As you can see, the select statement is simply setting the "currPic" variable to reference the next PictureBox in the series. If everything were working correctly, then clicking the button 3 times should produce this output:

currPic = pic1
currPic = pic2
currPic = pic3

But it produces this instead:

currPic = pic1
currPic = pic1
currPic = pic1

Based on this it looks like the assignment isn't happening at all; the Select statement always executes the "Case pic1" clause no matter what. But, after the Select statement, if I print currPic.Name to the Debug output, it prints the correct name ("pic1", "pic2", "pic3").

How can currPic have the correct name but not the correct object reference? I realize I can simply Select on currPic.Name and work around this, but I'm just curious about what's going on here. Am I doing something wrong, or is that the nature of object references in VB6?

Thank you!