Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 02-24-2010, 04:27 AM
RichardM RichardM is offline
Senior Member
 
Join Date: Dec 2005
Posts: 126
Default Passing Values

I have a standalone Unit with a Class field variable titled fFirstName which is public, I have a Form with a form field titled EditFirstName, the standalone unit can see the EditFirstName field of the form because I told it to use that unit but, I cannot get the EditFirstName text into the fFirstName variable of the standalone unit without first creating an instance of the standalone unit and passing the EditFirstName text to the unit from the form.

Is there a way to pass the EditFirstName text directly to the standalone unit class field without Instantiating the standalone unit from the form first

Thanks
Reply With Quote
  #2  
Old 02-24-2010, 01:22 PM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default

If it is a member of the class in the standalone unit, how do you expect to get it there if there is not an instance of the class, think about it...
__________________
MrBaseball34

Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Reply With Quote
  #3  
Old 02-24-2010, 03:04 PM
RichardM RichardM is offline
Senior Member
 
Join Date: Dec 2005
Posts: 126
Default Passing Values

Thanks !

You answered the question I asked but, perhaps my description of the problem is at fault picture it from the standalone unit trying to recieve field values to work with with in the class instead of from the form side

Type
TClassName = Class(TObject)

fFirstName :String;

Procedure InsertRecord;
End;

Implementation

Var
aForm :TFormName;
Begin
aForm := TFormName.Create;
fFirstName := aForm.EditFirstName.text;
End;

Here I can see the fields but fFirstName does not get the name entered in the in the form when the program runs, however if the Instantiation of the standalone unit class is done from the form side the field is then passed to the fFirstName field of standalone unit class, it works only one way from form to class I am trying to get

Thanks
For the response

Richard
Reply With Quote
  #4  
Old 02-24-2010, 04:10 PM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default

That is because fFirstName IS NOT a member of the aForm class and thus you are not setting it like you think you should be. Remember, if the class is not instansiated you cannot access its members.

There must be some other way for you to do this, why can you not make the fFirstName a public member of the aForm class?
__________________
MrBaseball34

Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Reply With Quote
  #5  
Old 02-24-2010, 05:17 PM
RichardM RichardM is offline
Senior Member
 
Join Date: Dec 2005
Posts: 126
Default Passing Values

Thanks Very Much

Richard
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 10:03 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2018, vBulletin Solutions, Inc.