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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing criteria from search form to results form 1

Status
Not open for further replies.

marina9

Programmer
Mar 5, 2002
32
US
Hi everyone!

I have a search form where users can enter values into text fields. Currently I am assigning the field values into an object that passes the values into a class I created. The class function ultimately places those values into a stored procedure to retrieve a recordset. I want to then call the class from another form (results) and place the records (based on the criteria selected) into a listview control.

The search form's field values are assigned to the variables in the class just fine, but when I call the class in the results form my class variables become 0 or "" again (like nothing was passed to them). Am I doing something wrong? Is this even possible using a class?

Thanks for any help! :)
 
With what scope have you declared the instance of the class?
This is probably something to do with the SCOPE (i.e. public, friend etc) of the class

"Own only what you can carry with you; know language, know countries, know people. Let your memory be your travel bag.
 
A likely cause is that the instance of the class in the second situation is a completely new object.

eg in Form1:
dim x as new class1
x.property = 24


in Form2:
dim x as new class1
msgbox x.property

gets you 0, because it is a different object.


Try making your object global, or a public member of a globally available form.

 
Thanks for your reply! The property let/get are all public, as is the function.
 
As Jeff says, How do you declare the actual class in both cases.



"Own only what you can carry with you; know language, know countries, know people. Let your memory be your travel bag.
 
Jeff is completely right. I can't believe I didn't figure it out! Thanks for the postings!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top