cannot access this.Item in BO in c#


Author
Message
Rob Toyias
Rob Toyias
StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)
Group: Forum Members
Posts: 31, Visits: 179
I'm trying to create a Custom Field.  I've created the public field in the BO, it will be filled by a stored procedure that joins accross tables.  I saw this done (today actually, thanks Trent!) where the filled value was accessed in the getter using Item() like so

get
{
    return Me.Item("DBColumnName");
}

problem is I'm using c#, and I don't have Item...

I use { return this.Item("DBColumnName") }
(or even Item[]) but it's not there...

I have CurrentDataTable, CurrentView, CurrentRowIndex, and CurrentRow but no Item.
I compile I get the following error:
Error 1 'BusinessObjectLib.Customers' does not contain a definition for 'Item' 

I'm thinking that should be in there, what silly thing am I doing wrong?

StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Ah, the Item property is called the Default property in VB, which translates to the this[] (indexer) property in C#.

So, you should be able to access it with:

get
{
    return this["DBColumnName"];
}

If you have a reference to a BO and you ever need to access the field, you can do the same thing:

BOType mybo = new BOType();
string value = mybo["someStringField"];

Just put the brackets directly after the reference, whether "this" or some bo variable.

Rob Toyias
Rob Toyias
StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)StrataFrame Beginner (37 reputation)
Group: Forum Members
Posts: 31, Visits: 179
I was so close, yet so far..

thanks for the info!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search