?
Solved

Method or data member not found.

Posted on 2000-04-07
7
Medium Priority
?
434 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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 150 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

585 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