Solved

Method or data member not found.

Posted on 2000-04-07
7
425 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

617 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