Solved

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

Posted on 2006-10-27
6
4,487 Views
Last Modified: 2013-12-03
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
0
Comment
Question by:estewb
6 Comments
 
LVL 15

Expert Comment

by:JackOfPH
ID: 17823921
Instead of this...
>>Dim objPic As Picture   [<= ERRORS HERE]

Try this...

Dim objPic As PictureBox

0
 
LVL 12

Accepted Solution

by:
guidway earned 125 total points
ID: 17823924
I think the reference you need is:

OLE Automation
0
 
LVL 15

Expert Comment

by:JackOfPH
ID: 17823947
Did It work?
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 17824408
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
 

Author Comment

by:estewb
ID: 17836993
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
 
LVL 12

Expert Comment

by:guidway
ID: 17847738
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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now