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

Passing Vb equivilent of "structs" between forms

P: n/a
Hi,

I'm working with VB 2005.net and have managed to get my head around passing
values between forms by creating properties of the relevant form classes.

However, say that I have a number of values which I wish to exchange (for
example, an employee record, name, position, etc). At the minute I'm using a
seperate property to for each "field".

I was wondering, is there a way to collate all the fields into one "object"
and use that as a property? I'm reminded of a "struct" from my C days and
was wondering if VB provided anything similar?

Any and all advice, tips, links and abuse are gratefully received.

Thanks

Chris,
Mar 31 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Structure / End Structure

"Chris Strug" <so********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I'm working with VB 2005.net and have managed to get my head around
passing values between forms by creating properties of the relevant form
classes.

However, say that I have a number of values which I wish to exchange (for
example, an employee record, name, position, etc). At the minute I'm using
a seperate property to for each "field".

I was wondering, is there a way to collate all the fields into one
"object" and use that as a property? I'm reminded of a "struct" from my C
days and was wondering if VB provided anything similar?

Any and all advice, tips, links and abuse are gratefully received.

Thanks

Chris,

Mar 31 '06 #2

P: n/a
"Martin" <x@y.com> wrote in message
news:uO***************@TK2MSFTNGP09.phx.gbl...
Structure / End Structure


Martin,

Thank you and apologies for my laziness / myopia when it comes to the help
files.

Thanks

CS
Mar 31 '06 #3

P: n/a
You're forgiven, the helpfiles of VS2005 are totally useless ;-)

"Chris Strug" <so********@hotmail.com> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
"Martin" <x@y.com> wrote in message
news:uO***************@TK2MSFTNGP09.phx.gbl...
Structure / End Structure


Martin,

Thank you and apologies for my laziness / myopia when it comes to the help
files.

Thanks

CS

Mar 31 '06 #4

P: n/a

"Chris Strug" <so********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
However, say that I have a number of values which I wish to exchange (for
example, an employee record, name, position, etc). At the minute I'm using
a seperate property to for each "field".
Properties of what? Each Form? Or a Class, each instance of which
represents an Employee?
I was wondering, is there a way to collate all the fields into one
"object" and use that as a property?


You could go with a Structure (the direct equivalent of struct) but,
personally, I'd jump straight in with a Class. Maybe something like this
(only with [lots] more Properties):

Class Employee
' ? Inherits BaseClassForAnyPerson

Private m_EmpNumber As String = Nothing

Public ReadOnly Property EmpNumber() As String
. . .
End Property

Public Sub LoadFrom( ByVal source As ... )
m_EmpNumber = source.Something
. . .
End Sub

Public Sub SaveTo( ByVal source As ... )
. . .
End Sub

Public Sub New( ByVal source As ... )
Me.LoadFrom( source )
End Sub

End Class

HTH,
Phill W.
Mar 31 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.