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

x
?
Solved

Method or data member not found.

Posted on 2000-04-07
7
Medium Priority
?
429 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
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 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

916 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