|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Passing Vb equivilent of "structs" between formsHi,
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, Structure / End Structure
Show quoteHide quote "Chris Strug" <solace1***@hotmail.com> wrote in message news:%23CVX5iKVGHA.4956@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, > "Martin" <x@y.com> wrote in message Martin,news:uOkc%23zKVGHA.776@TK2MSFTNGP09.phx.gbl... > Structure / End Structure > Thank you and apologies for my laziness / myopia when it comes to the help files. Thanks CS You're forgiven, the helpfiles of VS2005 are totally useless ;-)
Show quoteHide quote "Chris Strug" <solace1***@hotmail.com> wrote in message news:O0D1d3KVGHA.4960@TK2MSFTNGP12.phx.gbl... > "Martin" <x@y.com> wrote in message > news:uOkc%23zKVGHA.776@TK2MSFTNGP09.phx.gbl... >> Structure / End Structure >> > > Martin, > > Thank you and apologies for my laziness / myopia when it comes to the help > files. > > Thanks > > CS > "Chris Strug" <solace1***@hotmail.com> wrote in message Properties of what? Each Form? Or a Class, each instance of whichnews:%23CVX5iKVGHA.4956@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". represents an Employee? > I was wondering, is there a way to collate all the fields into one You could go with a Structure (the direct equivalent of struct) but,> "object" and use that as a property? 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.
Patterns anyone?
How do I detect a form being opened already From VB.NET to Word 2003 How can I get caption of all open windows?? VB 2005 variable declaration syntax Calling DLL atruntime settings.settings ?? LIstbox having multicolumn Print any doc ( .doc, .xls, .pdf, .jpg, .etc ) Saving binary to varbinary(max) data column in SQLserver 05 |
|||||||||||||||||||||||