By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,317 Members | 1,312 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,317 IT Pros & Developers. It's quick & easy.

Finding the Property's return type

P: n/a
Tom
Hey,

I'm trying to set every property in an inherited control to Browsable
false, so i can create some custom ones for what i need. I am generating
these automatically so i can copy+paste, but i am having trouble getting
the return type (To put in the property definition).

Dim spo As String = ""
For Each s As Reflection.PropertyInfo In MyBase.GetType().GetProperties
If s.CanRead Then
spo &= "<Browsable(False)_" & vbCrLf & "Public Overrides "
If True <s.CanWrite Then
spo &= "ReadOnly "
End If
spo &= "Property "
spo &= s.Name & "() As " & s.GetType.GetType().Assembly.FullName
spo &= vbCrLf & "Get" & vbCrLf & vbCrLf & "End Get" & vbCrLf
If s.CanWrite Then
spo &= "Set(Byval value)" & vbCrLf & vbCrLf & "End Set" & vbCrLf
End If
spo &= "End Property" & vbCrLf & vbCrLf
End If
Next
s.GetType.GetType().Assembly.FullName is where i would like the string
of the return type of that property but icannot figure out how to get
the return type...
Cheers
Jul 26 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Tom,

What about s.PropertyType.Name?

Kerry Moorman
"Tom" wrote:
Hey,

I'm trying to set every property in an inherited control to Browsable
false, so i can create some custom ones for what i need. I am generating
these automatically so i can copy+paste, but i am having trouble getting
the return type (To put in the property definition).

Dim spo As String = ""
For Each s As Reflection.PropertyInfo In MyBase.GetType().GetProperties
If s.CanRead Then
spo &= "<Browsable(False)_" & vbCrLf & "Public Overrides "
If True <s.CanWrite Then
spo &= "ReadOnly "
End If
spo &= "Property "
spo &= s.Name & "() As " & s.GetType.GetType().Assembly.FullName
spo &= vbCrLf & "Get" & vbCrLf & vbCrLf & "End Get" & vbCrLf
If s.CanWrite Then
spo &= "Set(Byval value)" & vbCrLf & vbCrLf & "End Set" & vbCrLf
End If
spo &= "End Property" & vbCrLf & vbCrLf
End If
Next
s.GetType.GetType().Assembly.FullName is where i would like the string
of the return type of that property but icannot figure out how to get
the return type...
Cheers
Jul 27 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.