UDF with custom object

Add-in Express™ Support Service
That's what is more important than anything else

UDF with custom object
Any option to send Student instance as parameter ? 
Ted Donavan




Posts: 4
Joined: 2008-05-03
Is there any possibility to send Student instance (Your custom object) as a parameter or get as return parameter..
Do you know any tricks ?

UDF:

public static Student GetStudent (ClassRoom classroom,int studentId)
{
return classrom.GetSetudent(studentId);
}
Posted 03 May, 2008 14:05:26 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Ted.

What is the Student instance? Is it an object embedded in the Excel cell?
If so, you can pass an Excel range as a parameter.
Posted 05 May, 2008 14:38:49 Top
Ted Donavan




Posts: 4
Joined: 2008-05-03
Student is only sample instance.
For example it has Id and Name property..
Classroom is an other instance.
For example it has Id and Students

GetStudent is a function that gets Classroom instance and returns Student instance.

GetClassroom is a function that gets int and returns Classroom instance..

In Excel When i fill cells like that:

GetStudent(GetClassroom(3),7)
After GetClasroom evaluated ,Classroom's ToString() method is evaluated
and Clasroom object converted to string ..

Any suggestion ..
How can I Embed Custom Class to Excel cell for nested calls ?


Posted 07 May, 2008 04:43:34 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Ted.

You can return supported types only. I would advise you to return a string and create a new instance of the Student object based on the string data retrieved from the Excel cell.
Posted 07 May, 2008 07:51:56 Top