473,412 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Passing Vb equivilent of "structs" between forms

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
4 1296
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
"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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: copx | last post by:
I want to save a struct to disk.... as plain text. At the moment I do it with a function that just writes the data using fprintf. I mean like this: fprintf(fp, "%d %d", my_struct.a, my_struct.b)...
3
by: ESPNSTI | last post by:
Hi, I'm looking for a way to associate multiple "lists" of constants to each other. For example, I'd like a way to look up a database column's name based on its "number" in a constants list. ...
10
by: mdh | last post by:
Quick question about pointers. Wrote this "trying to understand this better" code: int *ptr, x = 565; ptr= &x; printf("\n\n\nThe value of x is %d\n", x);
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
0
iknc4miles
by: iknc4miles | last post by:
Back with another question. How I go about rewriting this code so that I can pass the pointer to my data from one form to another to be modified there. Here is roughly what I'm doing, but the...
29
by: not.here.now | last post by:
A quick search of this group and its FAQ, and elsewhere, have not answered this question to my satisfaction. Apologies if I missed something obvious, either in the literature or my reasoning. ...
8
by: not_a_commie | last post by:
A method parameter declared as "const ref" would allow for passing large structs quickly and enforce that the struct does not get reassigned. I know there was concern before about the inability of...
0
by: raylopez99 | last post by:
I ran afoul of this Compiler error CS1612 recently, when trying to modify a Point, which I had made have a property. It's pointless to do this (initially it will compile, but you'll run into...
18
by: Stephan Beal | last post by:
Hi, all! Before i ask my question, i want to clarify that my question is not about the code i will show, but about what the C Standard says should happen. A week or so ago it occurred to me...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.