Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a Class

Status
Not open for further replies.

sagn

Programmer
Jun 7, 2001
166
US
Hi

I have, or at least have tried to, create a class.
Using the CompaqVisualBasic 6 interface I
opened a new class module. (I did not use the builder)

I saved the class.

In my project window it appears as

Class1(IO.cls) (why does the 'class1' still appear?

And when I try and use the class by creating an instance
via

Set NEWIO = IO

I get an error saying the user defined type in undefined.

What am I doing wrong?

(The class I built is an addition to previously existing code)

thanks

diane
 
Hi Diane -

I think you have a couple of problems. Not knowing exactly how your project is put together, I'll take a couple of guesses:

First, the "Class1" text is the class name as defined in the IDE; IO.CLS is the file name. You'll want to assign the value "IO" to the Name property of the the class.

Secondly, you can define and instantiate an class variable in different ways. You may want to try the following:
Code:
'Declarations section
[Public/Private] NEWIO as IO
'In a Sub/Function
Set NEWIO = New IO

Hope this is helpful,



<bw>
"I swear by my life and my love of it that I will never live for the sake of another man, nor ask another man to live for mine."
— John Galt
Atlas Shrugged

If you want to get the best response to a question, please check out FAQ222-2244 first

 
Thank You Very much

I changed the Name property, something I did not even think of.
and then I added the statement

Dim NEWIO As IO

then later

Set NEWIO as NEW IO

That seemed to get over my compilation problem!

Thanks again

diane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top