473,503 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populating Structure Arrays

If you define a structur
Private Structure Str
Dim X as Intege
Dim Y as Strin
End Structur

Is there a way to populate the structre when you define the array
Dim XX() as StrX = Str((1,'A'), (2,'B')

Thank

David
Nov 20 '05 #1
2 1949
CT
Well, you could something like this, adding a constructor with the required
parameters:

Private Structure StrX
Dim X As Integer
Dim Y As String

Sub New(ByVal xParam As Integer, ByVal yParam As String)
X = xParam
Y = yParam
End Sub
End Structure

and when intializing something like this:

Dim XX() As StrX = New StrX() {New StrX(1, "a"), New StrX(2, "b")}

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
"David Stephen" <an*******@discussions.microsoft.com> wrote in message
news:81**********************************@microsof t.com...
If you define a structure
Private Structure StrX
Dim X as Integer
Dim Y as String
End Structure

Is there a way to populate the structre when you define the array.
Dim XX() as StrX = Str((1,'A'), (2,'B'))

Thanks

David

Nov 20 '05 #2
CT
Well, you could something like this, adding a constructor with the required
parameters:

Private Structure StrX
Dim X As Integer
Dim Y As String

Sub New(ByVal xParam As Integer, ByVal yParam As String)
X = xParam
Y = yParam
End Sub
End Structure

and when intializing something like this:

Dim XX() As StrX = New StrX() {New StrX(1, "a"), New StrX(2, "b")}

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
"David Stephen" <an*******@discussions.microsoft.com> wrote in message
news:81**********************************@microsof t.com...
If you define a structure
Private Structure StrX
Dim X as Integer
Dim Y as String
End Structure

Is there a way to populate the structre when you define the array.
Dim XX() as StrX = Str((1,'A'), (2,'B'))

Thanks

David

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
4015
by: Friday | last post by:
Sorry if this is the wrong group. I tried to find the one I thought would be most relevant. I'm an old PHP guy, who knows little about asp and NOTHING about asp.net, but need to learn at least...
2
4824
by: Steve Turner | last post by:
I have read several interesting posts on passing structures to C dlls, but none seem to cover the following case. The structure (as seen in C) is as follows: typedef struct tag_scanparm { short...
0
267
by: David Stephen | last post by:
If you define a structur Private Structure Str Dim X as Intege Dim Y as Strin End Structur Is there a way to populate the structre when you define the array Dim XX() as StrX = Str((1,'A'),...
4
2495
by: Chuck Ritzke | last post by:
Okay, just when I thought I was starting to understand stuff. In VB6... Type MyDataType Dim Value1 as double Dim Value2 as double End Type Dim MyData1 as MyDataType Dim MyData2 as MyDataType
2
1942
by: James | last post by:
Hi, I need help with a couple of questions, I have create and structure like: Structure byteArray Public byteA() As Byte End Structure Public ptrArray() As byteArray
3
6026
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
14
1765
by: Dennis | last post by:
If I have a structure like; Public Structure myStructureDef Public b() as Byte Public t as String End Structure If I pass this structure, will the values in the array b be stored on the...
10
4967
by: David Fort | last post by:
Hi, I'm upgrading a VB6 app to VB.net and I'm having a problem with a call to a function provided in a DLL. The function takes the address of a structure which it will fill in with values. I...
8
2527
by: jack-b | last post by:
Hi, I have a list box which displays countries names and a second listbox which displays their cites (based on the selection made in ListBox 1) If the user selects USA i want to display cities...
0
7076
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7274
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
7323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6984
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
7453
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4670
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...
0
3162
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.