473,804 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UDT Array in an array

Greetings:

I need some guidance. I have been using UDT's and arrays to hold
information so I can easily display data and save it. I am in the
process of building a new form and ran across a problem I can't figure
out how to solve.

I have a UDT as follows:

Public Type udtBL
scac As String * 4
BL As String * 12
GrossWt As Double
GW_UOM As String * 1
PcCt As Double
PC_UOM As String * 4
po_id() As Long
po() As String * 20
Status() As String * 2
ContainerNumber () As String * 11
SealNumber() As String * 20
TypeID() As Integer
ContGW() As Double
ContGW_UOM() As String * 1
contPC() As Double
ContPC_UOM() As String * 4
ContVol() As Double
ContVol_UOM() As String * 4
End Type

In my form I do the following

Option Explicit
Dim BL() As udtBL

Private Sub Form_Load()
Redim BL(1 to 100)
'-----Then I load it using the syntax BL(i).Container Number(x) =
"Container1 "
End Sub
This is all fine and dandy, but in this particular form, the Container
has multiple PO numbers I want to load as well. I have no idea how to
do this.

So i have my BL(1).BL = "BL1"
my BL(1).Container (1) = "Container1 "
But then Container1 has two Purchase Orders that go with it...PO1 and
PO2.

How can I store the Purchase Orders for that container?

I would think it should be BL(1).Container (1).PO(1)

Can I do this? If so, what is the syntax? Is there a better, more
efficient way to deal with this? I am very comfortable with arrays.

I would really appreciate any help.

--rowan
Jul 17 '05 #1
1 5142
Personally ... and this would necessitate a re-write of the app ... I would
group related array-type Type members into their own UDTs, and include those
in the final UDT. For example, air code based on what appears related in
your app:

Private Type POItems
po_id As Long
po As String * 20
status As String * 2
End Type

Private Type ContainerItems
Container as <whatever>
ContainerNumber As String * 11
End Type

Private Type udtBL
<your other members>
podata() as POItems
containers() as ContainerItems
End Type

.... then use appropriately ...

dim BL() as udtBL
Redim BL(1 to 100) as udtBL ... etc etc

BL(4).container s(23).Container Number = "A4K118171"
BL(4).container s(23).container = "Container1 "
BL(4).podata(23 ).po_id = 12345
BL(4).podata(23 ).po = "HWK 113-131"
.... etc.

This way you can increase the number of containers or POs easily with one
redim.

--

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Rowan" <ph********@yah oo.com> wrote in message
news:4b******** *************** ***@posting.goo gle.com...
: Greetings:
:
: I need some guidance. I have been using UDT's and arrays to hold
: information so I can easily display data and save it. I am in the
: process of building a new form and ran across a problem I can't figure
: out how to solve.
:
: I have a UDT as follows:
:
: Public Type udtBL
: scac As String * 4
: BL As String * 12
: GrossWt As Double
: GW_UOM As String * 1
: PcCt As Double
: PC_UOM As String * 4
: po_id() As Long
: po() As String * 20
: Status() As String * 2
: ContainerNumber () As String * 11
: SealNumber() As String * 20
: TypeID() As Integer
: ContGW() As Double
: ContGW_UOM() As String * 1
: contPC() As Double
: ContPC_UOM() As String * 4
: ContVol() As Double
: ContVol_UOM() As String * 4
: End Type
:
: In my form I do the following
:
: Option Explicit
: Dim BL() As udtBL
:
: Private Sub Form_Load()
: Redim BL(1 to 100)
: '-----Then I load it using the syntax BL(i).Container Number(x) =
: "Container1 "
: End Sub
:
:
: This is all fine and dandy, but in this particular form, the Container
: has multiple PO numbers I want to load as well. I have no idea how to
: do this.
:
: So i have my BL(1).BL = "BL1"
: my BL(1).Container (1) = "Container1 "
: But then Container1 has two Purchase Orders that go with it...PO1 and
: PO2.
:
: How can I store the Purchase Orders for that container?
:
: I would think it should be BL(1).Container (1).PO(1)
:
: Can I do this? If so, what is the syntax? Is there a better, more
: efficient way to deal with this? I am very comfortable with arrays.
:
: I would really appreciate any help.
:
: --rowan

Jul 17 '05 #2

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

Similar topics

2
2785
by: Brian | last post by:
I'm diddlying with a script, and found some behavior I don't understand. Take this snippet: for ($i = 0; $i <= count($m); $i++) { array_shift($m); reset($m); }
2
575
by: Stormkid | last post by:
Hi Group I'm trying to figure out a way that I can take two (two dimensional) arrays and avShed and shed, and subtract the matching elements in shed from avShed I've pasted the arrays blow from a print_r cmd any suggestions would be great. Thanks much Todd //avShed array Array ( => Array ( => 1 => 08:00 ) => Array ( => 1 => 08:05 ) => Array ( => 1 => 08:10 ) => Array ( => 1 => 08:15 ) => Array ( => 1 => 08:20 ) => Array...
15
5197
by: lawrence | last post by:
I wanted to test xml_parse_into_struct() so I took the example off of www.php.net and put this code up on a site: <?php $simple = <<<END <item>
8
3486
by: vcardillo | last post by:
Hello all, Okay, I am having some troubles. What I am doing here is dealing with an employee hierarchy that is stored in an array. It looks like this: $employees = array( "user_id" => array( "name", "title", "reports to user id", "start date in the format: mm/dd/yyyy" ) ); How can I display this hierarchy in simple nested <li> tags in the most
12
55576
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are also removed) So far I have (val is value, ar is array, returns new array):
8
10235
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when it is assigned a text literal?? HOW can I change the array value to upper case then? What other method exists for arrays? Ex: var GridArrayName1 = new Array(); GridArrayName1 = new Array ('test-value'); GridArrayName1 = GridArrayName1...
58
10188
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of code... TCHAR myArray; DoStuff(myArray);
104
17026
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from that array Could you show me a little example how to do this? Thanks.
7
3202
by: Jim Carlock | last post by:
Looking for suggestions on how to handle bad words that might get passed in through $_GET variables. My first thoughts included using str_replace() to strip out such content, but then one ends up looking for characters that wrap around the stripped characters and it ends up as a recursive ordeal that fails to identify a poorly constructed $_GET variable (when someone hand-types the item into the line and makes a simple typing error).
17
7261
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need to show the array data to the end user. Can I do that? How?
0
9593
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10343
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10335
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7633
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6862
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5529
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3831
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.