Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-10-27
6
Medium Priority
?
4,575 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 500 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 86

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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

927 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