Solved

Method or data member not found.

Posted on 2000-04-07
7
423 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

735 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