|
-
Aug 4th, 2011, 05:14 PM
#1
Thread Starter
Addicted Member
DataBind Formview to function with progrmatic type
I'm trying to databind a formview to the following two functions.
Is there an easy way to do this?
ODS doesnt like the "of configtype as new"
Public Shared Function GetConfig(Of configtype As New)() As configtype
End Function
Public Shared Function SetConfig(ByVal configItem As Object) As Boolean
End Function
-
Aug 5th, 2011, 01:14 AM
#2
Re: DataBind Formview to function with progrmatic type
Granted, my VB.Net is as up to date as my C#, but to me, that Function definition doesn't look right to me at all.
Can you clarify what you are trying to do in the parameter list? You haven't specified whether the parameter is ByVal or ByRef.
What am I missing?
Gary
-
Aug 5th, 2011, 04:04 AM
#3
Thread Starter
Addicted Member
Re: DataBind Formview to function with progrmatic type
Sorry, I should have specified this is VB, but I figured you worked that out....
This particular function requires you to pass in an object which defines the return type so you can get an explicit type.
The challenge I'm having is that the object data source doesn't seem to handle the config type GetConfig(Of configtype As New)()
"Of configtype as New" means that the object must have a constructor , so a simplistic example would be :
Public Shared Function GetConfig(Of configtype As New)() As configtype
Dim myObj As New configtype
return myObj
End function
this will return an object of type configType
config type is just a custom class.
Edit** to give you another example
Public Shared Function GetConfig(Of configtype As New)(ID as integer) As configtype
this shows a traditional parameter as well which you might be more familiar with.
Last edited by DanInManchester; Aug 5th, 2011 at 04:32 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|