eramgarden Posted December 5, 2005 Posted December 5, 2005 I have a function that returns a string array. A developer said I can do this: return a User object. As things get more complex, add properties to that user object. Anyone has an exmple of creating and returning a userobject? Quote
Nate Bross Posted December 7, 2005 Posted December 7, 2005 I believe this is what you are looking for. 'User Object Public Class UserObject Dim sValue as String 'Local copy of global value Sub New(ByVal str as String) sValue = str End Sub Sub New () New(New String("MyNewValue") End Sub Public Property MyValue() As String Get Return sValue End Get Set(ByVal value As String) sValue = value End Set End Property End Class 'Form1 Code Dim mObj as UserObject mObj = MyFunction(False) Public Function MyFunction(ByVal bln as Boolean) as UserObject Dim localObj as UserObject If bln = True Then localObj.Value = "True" Else localObj.Value = "False" End If Return localObj End Function Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.