User-defined type not defined - VB 6 - "Picture" Type

I have a VB 6.0 project that suddenly started giving me an error on compile

The particular code area that errors out first is :

Private Sub Picture1_Click()
    Dim objPic As Picture   [<= ERRORS HERE]
    Set objPic = LoadPicture(ActiveFileLocation & "Images\class_small_down.jpg")
    Set Picture1.Picture = objPic
    idPassed = 0
    frmClassesEntry.Show
    Set objPic = LoadPicture(ActiveFileLocation & "Images\class_small.jpg")
    Set Picture1.Picture = objPic
End Sub

I originally wrote this application some time ago; and I've added to its capabilities many times through the past couple of years.  There are many things included in it, including a number of Crystal Reports, external OLE calls to Microsoft IE to gather Web information automatically, etc.

At any rate, it suddenly simply will not compile.  I've played around a good bit with the Components and References, thinking that was the obvious answer.  Currently, Components, Designers, and References are (I just listed everything!):

COMPONENTS:
Crystal ActiveX Query Viewer 1.0 Type Library
Crystal Report Control
Crystal Report Viewer Control
Crystal Select Expert OLE Control Module

Microsoft ADO Data Control 6.0 (SP6) (OLEDB)
Microsoft Common Dialog Control 6.0 (SP6)
Microsoft DataGrid Control 6.0 (SP6) (OLEDB)
Microsoft DataList Controls 6.0 (SP6) (OLEDB)
Microsoft Internet Controls
Microsoft Masked Edit Control 6.0 (SP3)
Microsoft PictureClip Control 6.0 (SP3)
Microsoft Rich Textbox Control 6.0 (SP6)
Microsoft Tabbed Dialog Control 6.0 (SP6)
Microsoft Windows Common Controls 6.0 (SP6)
Microsoft Windows Common Controls-2 6.0 (SP6)

DESIGNERS:
Crystal Reports 8
Data Environment
Data Report
DHTML Page
Microsoft Forms 2.0 Form
WebClass


REFERENCES:
Visual Basic For Applications
Visual Basic runtime objects and procedures
Visual Basic objects and procedures
Crystal Report Viewer Control
Cyrstal Report 8 ActiveX Designer Run Time Library
Crystal Report 8 ActiveX Designer Design Time Library (Internal)
Crystal ActiveX Query Viewer 1.0 Type Library
Crystal Report 8 Standard Wizard library
Crystal Report Engine 8 Object Library
Crystal Report Export
Crystal Report Viewer Control
Crystal Reports 8 Library
Crystal Data Object
cryptext 1.0 Type Library
Microsoft Management Console 2.0
Microsoft Internet Controls
Microsoft ActiveX Data Objects (Multi-dimensional) 2.8 Library
Microsoft Data Report Designer 6.0 (SP4)
Microsoft Data Source Interfaces
Microsoft ActiveX Data Objects 2.5 Library
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Objects Recordset 2.8 Library

Any help anyone can give me would be GREATLY appreciated.  Thanks!

estewb
estewbAsked:
Who is Participating?
 
guidwayConnect With a Mentor Commented:
I think the reference you need is:

OLE Automation
0
 
JackOfPHCommented:
Instead of this...
>>Dim objPic As Picture   [<= ERRORS HERE]

Try this...

Dim objPic As PictureBox

0
 
JackOfPHCommented:
Did It work?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Try StdPicture instead...

    Dim objPic As StdPicture

From the help file on Picture:

    You can not create a Picture object using code like Dim X As New Picture. If you want to create a Picture object, you must use the StdPicture object like this:

    Dim X As New StdPicture
0
 
estewbAuthor Commented:
Thanks, everyone, for your comments and suggestions!  The correct answer turned out to be the one from "guidway" who suggested putting OLE Automation in the reference list!  That solved the problem.  

Now, it gets past the error on "Picture" type; but throws a new error on some Datagrid control code that previously was compiling without a hitch:


    Set dgEMailList.DataSource = swsExpRS

    Dim c As Column
    For Each c In dgEMailList.Columns
        Select Case c.DataField     [<== ERRORS OUT RIGHT HERE]
            Case "ID"
                c.Visible = True
                c.Caption = "ID #"
                c.Width = 950
            Case "Licensees name"
                c.Visible = True
                c.Caption = "Name"
                c.Width = 1900
            Case "Email address"
                c.Visible = True
                c.Caption = "E-Mail Address"
                c.Width = 2800
            Case "Zip code"
                c.Visible = True
                c.Caption = "Zip"
                c.Width = 950
            Case "FailureCount"
                c.Visible = True
                c.Caption = "# Failures"
                c.Width = 950
            Case "Matched"
                c.Visible = True
                c.Caption = "Matched?"
                c.Width = 1000
            Case Else ' Show all other columns.
                c.Visible = True
        End Select
    Next c

The error says, "Compile error:  Method or data member not found."

The really puzzling thing is that I have been compiling this thing for years; and suddenly it won't compile.  Obviously, I must have changed something when I just added an OLE call to Microsoft IE; but I just don't know what it is!  As you can see in the original post, I've got the ADO Data Control 6.0, the Datagrid Control 6.0 AND Datalist Control 6.0 already included.  Any other suggestions?

Thanks again for the input!
0
 
guidwayCommented:
Hi estewb,

My only suggestion on the new error is check that the datasource is properly set up and nothing changed from that end. It sounds like a data connection problem to me, however I'm not familiar with that error.

guid
0
All Courses

From novice to tech pro — start learning today.