Seting Default Values


Author
Message
Bradley Marston
Bradley Marston
StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)StrataFrame Novice (70 reputation)
Group: Forum Members
Posts: 24, Visits: 119
I have a BO with a lot of fields that need to set with defaults, I also have a datatable with the field name and value. Is there a way to set these defaults looping thru the data table without having to use a select case where i must type Case datatable.fieldname = me.fieldname. For example in vfp one could use macro

substitution , but not in vb.net or c sharp.net

Reply
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Yeah...as you already know, macros were a very dangerous thing since it was not strong-typed, but also a useful tool when you just want to "strong-arm" something.  In .NET, you will use reflection.  However, in this example you can just use the CurrentRow exposed on the BO.

Dim loRow As DataRow

For Each loRow IN MyTempDataTable.Rows
    MyBO.CurrentRow.Item(loRow.Item("FieldName")) = loRow.Item("FieldValue")
Next


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