Solved

Method or data member not found.

Posted on 2000-04-07
7
413 Views
Last Modified: 2012-05-04
Hi
Facts, I use VB 6 SP3, Win NT 4.0 and a Tool from Videosoft VSView6 (printtool)

And the problem is, when I start to compile the program with F5, it runs. And when I start with STRG+F5 ( Start with complete compiling) an error with message "Error from compiling. Methode or data member not found".

See attached source, all methods behind the object VSPrinter highlights the errormessage.

I installed the newest ocx component and registerd it, also the spelling in the source is right.

Example;
 If VSPrinter.PageCount > 0 Then   VSPrinter.PrintDoc

 With VSPrinter
     VSPrinter.Preview
     VSPrinter.StartDoc
     VSPrinter.Header = "FBL" & frmNr & "     " & frmName & "||"
and so on...

Can anybody give me a help, is there a missing file?
Thanks for answering.
0
Comment
Question by:geha
7 Comments
 
LVL 1

Expert Comment

by:North
ID: 2693041
When using the "With" command there is no need to write "VSPrinter" in front of each of it's properties/methods, example;

Use either;

VSPrinter.Preview
VSPrinter.StartDoc
etc..

Or;

With VSPrinter

  .Preview
  .StartDoc
  etc.

End With

I'm not saying this will fix your problem, but it might, give it a try.

North.
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2693165
Assuming you have added the control to your form (You have, haven't you? If not.. click on Vb Menu -> Project -> Components.. check the appropriate contol name, and hit Ok.. a new Icon will then appear in your Toolbox, in Form view double click on it to add it to the form.).. the only reason this message would appear is that you have tried to use a control Method that either does not exist.. or have neglected to add a property that the control requires.

Once the Contorl is added to your form you can use the Object Browser to Expose all the Methods and properties of the control. By clicking on the Method in the Object Control, you can see what if/any parameters are needed.

Another way to do this.. is in the IDE typing the name of the object with a . after it, a popup should appear showing you all the Objects properties and methods for you to choose. Make sure the properties/methods you are using appear on that list. If they don't, you will get the error you mentioned above.

To find out if a Method requires parameters, again in the IDE, type a left parenthesis after the method name. A tool help window should appear delineating the parameter string required.

When you use the Shift F5 function, it compiles the WHOLE program, even parts that you may not be using. Sometimes in developing we leave little bits of code as notes, that we may.. or may not want to use later. In using your Shift F5, make sure those other areas are cleaned up before proceeding, or often, you will get messages like the one you are referring to above.
0
 

Expert Comment

by:longstone
ID: 2693173
1) You shoulnd't use such a statement:
  with ObjectName
      ObjectName(again).method
  end with
(otherwise "with" becomes useless)

2)Have you tried to write the object name followed by a . (dot) ,in order to preview the available methods?
(I mean,are you sure those methods belongs to that object?)
   

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 10

Expert Comment

by:caraf_g
ID: 2693796
North, longstone,

Although you're right, it couldn't explain the error.

Apart from being unnecessary, there is nothing wrong with

With ANObject
    ANObject.SomeProperty = SomeValue
End With

The problem is most likely caused by your declaration of VSPrinter. It seems that you have not declared VSPrinter as the correct data type.

Find the declaration, and check it out.

As wsh2 says, it is also possible that you've added VSPrinter to your form as a control.

In that case, have you had any error messages before this started happening. Most notably, did you get any errors saying "Error loading Form blahblah... etc... " pointing you at a Log file? If that happens it could be that you lost a project reference. In that case, it would complain about the VSPrinter control, and *IMPORTANT* it messes you about and changes this control to a Picture Box.

Even if you then go and restore the correct references and components to your project, you're screwed: the control VSPrinter has changed to a picture box, and hence it will no longer support the original set of methods and properties, and this will cause problems just like the ones you're describing.
0
 
LVL 10

Accepted Solution

by:
caraf_g earned 50 total points
ID: 2693816
PS - if the latter is what has happened to you, and you've restored the correct component to your project, you can fix it as follows:

1 - Don't touch the code
2 - remove The Picturebox Formerly Known As VSPrinter
3 - Put a new <whatever control VSPrinter is supposed to be> in its place
4 - Name it VSPrinter again

And you should be OK again.
0
 
LVL 1

Expert Comment

by:tirupur_selva
ID: 2695800
I think you cannot use 'With End With' for a printer control. I have tried this with the normal statement.
Eg:
With Printer
   .print "Checking"
   .CurrentX = 1.2
End With
The above will not work and will give error. The same may be the case with your control too.


 
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2699726
Er....

I only commented on this question. If you want to accept that as an answer, that's fine with me, but to give me a "B" is a bit rich. :-(
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

758 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