473,387 Members | 1,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Can't reference Object properties

3 1493
Roger Maynard <ro***@crayford.ltd.uk> wrote:

<snip>
Also, how would I add code after the call to return the object, which
references the properties of the newly created object?

ie

object ret_obj = testmyClass.SalesRecordRead("A&B");
string AcRef = ret_obj.szRefn;
If I do the above, then the compiler bitches about ret_obj as undefined,
etc.


Yes, it would - it only knows that ret_obj is a reference to an
instance of object or a subtype. Object itself doesn't have a szRefn
member. You need to declare ret_obj to be of type SalesHeader, and
declare SalesRecordRead to return that, too.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

Hi Jon

Well, I've been around and around this all day yesterday but still can't
get anywhere with it !!

It's driving me nuts!

Can someone point me at some reference reading material to really
understand the issues involved here or any examples of passing objects
around.

I also getting really confused with what is available within the scope
etc

I guess I just missed something!

Best regards,

Roger

-----Original Message-----
From: Jon Skeet [C# MVP] [mailto:sk***@pobox.com]
Posted At: 04 August 2004 12:28
Posted To: microsoft.public.dotnet.languages.csharp
Conversation: Can't reference Object properties
Subject: Re: Can't reference Object properties

Roger Maynard <ro***@crayford.ltd.uk> wrote:

<snip>
Also, how would I add code after the call to return the object, which
references the properties of the newly created object?

ie

object ret_obj = testmyClass.SalesRecordRead("A&B");
string AcRef = ret_obj.szRefn;
If I do the above, then the compiler bitches about ret_obj as undefined, etc.


Yes, it would - it only knows that ret_obj is a reference to an
instance of object or a subtype. Object itself doesn't have a szRefn
member. You need to declare ret_obj to be of type SalesHeader, and
declare SalesRecordRead to return that, too.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #3
Roger Maynard <ro***@crayford.ltd.uk> wrote:
Well, I've been around and around this all day yesterday but still can't
get anywhere with it !!
Well, what happened when you tried the changes I suggested?
It's driving me nuts!

Can someone point me at some reference reading material to really
understand the issues involved here or any examples of passing objects
around.

I also getting really confused with what is available within the scope
etc

I guess I just missed something!


These sound like things for a C# tutorial or book, to be honest. It's
not a reference material type question so much as just learning C# to
start with.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: brazilnut52 | last post by:
I am going to outline the steps I go through to produce the problem. Hopefully this will help you understand the problem better I have created a simple COM DLL in .NET by using the COM class...
9
by: pablo | last post by:
Dear NGers, I would like to change the alt-text with the changing of the image during a mouseover action. Can document.images.altView be changed dynamically? TIA, pablo
26
by: Dave Hammond | last post by:
In document "A.html" I have defined a function and within the document body have included an IFRAME element who's source is document "B.html". In document "B.html" I am trying to call the function...
3
by: Poewood | last post by:
Okay here are four classes for a pocket pc program: Input, fpositional, ComboBoxArray and TextBoxArray. The "input" class is the form. I use the fpositional class to handle most of the functions...
3
by: Sushil Srivastava | last post by:
Hi Guys, Would you be able to help me using C# GUI (with user interface component) in my MFC application. I have used managed extension, COM-interops, etc but problem is this C# component has...
5
by: Just Me | last post by:
Given a button name Btn_5 and Index=5 I want to do something like dim zz as string = Btn_??Index??.Text or given an array of buttons, do:
13
by: Andy Baxter | last post by:
Can anyone recommend a good online guide to using objects in javascript? The book I bought (DHTML Utopia) suggests using objects to keep the code clean and stop namespace clashes between different...
37
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as...
6
by: kbin | last post by:
Hi all, I'm wondering if it is possible to have some sort of soft reference to an object's properties by using a string representing the property name. Let me explain by an example, here is my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.