473,385 Members | 1,309 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,385 software developers and data experts.

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 1945
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
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
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
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
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
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
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
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
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
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.