I need to pass around the details of a db record a few times and was wondering about using structures. If I create a structure something like the one listed below in one of my XXX.vb files, can I use it like a variable?
**USERDB.VB File**
Public Structure UserDetails
puplic FirstName as string
public LastName as string
End Structure
Public Function GetUserDetails(byval UID as Integer) as UserDetails
**Database crap here**
GetUserDetails.FirstName = objDR("FirstName").tostring
GetUserDetails.LastName = objDR("LastName").tostring
End Function
**WEBFORM1.ASPX.VB**
Private Sub ShowUser(byval UID as integer)
Dim objUserDetails as UserDetails
objUserDetails = GetUserDetails(UID)
lblFirstName.text = objUserDetails.FirstName
lblLastName.text = objUserDetails.LastName
End Sub
Sorry so long. Do I need to destroy the objects when done with them?
Thanks,
DougMaybe use a class instead? Any help would be great!
0 comments:
Post a Comment