Matching 2 Variables With Arrays Or Lists To Get 3rd Value?

Nov 11, 2011

I have a pipe delimited file with 3 values on each line, something like this:
0001|234587|Bracket, 3 x 3 x 0.125, Steel
0001|254378|Bracket, 4 x 4 x 0.125, Steel
0003|234587|Hinge, 4 x 4 x 0.125, Brass

The first Value can be duplicated in the file, the second value also can be duplicated. There are no instances of BOTH values duplicated on 2 or more lines. I need to read another file and get the first 2 values, then look up those two on one line to get the proper 3rd value. The "other" file looks a bit like this:
0E0522070001EF54ED7823458700FF00FFA5A5A5A5
-----------XXXX-----------XXXXXX--------------------- (X's are the data, the rest is filler to comply with some code unknown to me)

Right now I have code to read all into an array (split on vbcrlf), then split each line on "|" and populate three arrays, I then go thru every element of the first column that matches the value I am looking for and test that the second column also matches the second value and if so, return the third array contents at the same index. This seems crude and inefficient. Cannot use a hashtable (I don't think) as it only supports 2 values. A List(Of) doesn't seem to work either and I don't want to use a database.

View 6 Replies


ADVERTISEMENT

Comparing Large Array Lists - Matching Strings?

Apr 26, 2011

I have two array list same size, depending on the information gathered by previous functions. The size of the arrays range from 2 - 45 in length, both arrays always have the same length. I am trying to match one string in one array to another string in the second array. When they match then add Item to List.

Here is my
Do Until i = Arraylenght
info = Replace(myAL(s), " ", "")
SortedArrayList(m) = Replace(SortedArrayList(m), " ", "")
SortedLine = Split(SortedArrayList(m), "Price=")
If myAL(s).Contains(SortedLine(1)) Then
[Code] .....

This code works up to an array of not more then 4 in lenght, when working larger size array then 4, the minute it get to 5 I get this Error:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

View 13 Replies

Use Arrays Or Lists When Sorting?

Jun 24, 2011

I have been assigned a program for homework in which I need to take in information about songs from a text file and then be able to sort the list alphabetically, by genre and by length. I also need to be able to filter it by genre. The user can then move songs they choose from the master list to a playlist where again the list can be sorted by either genre or play order.My book only covered sorting array when they are one dimensional however I need to be able to sort a multidimensional array by different columns. I asked my teacher but she had so much going on that we didn't really have time to get into it, so I decided to ask here.

I'm not looking for code, just to get pointed in the right direction. For instance rather than using a multidimensional array would it be better to pull the values in and then put them into an array of song objects with properties for each value? And if I choose to go that route is an array the best structure to use? I have to use an array of some type, but the problem says nothing about whether or not it can be a list or other array type structure.

View 6 Replies

Arrays - Compare Two Lists 2D And Determine

May 2, 2012

I declare my 2D lists:

Dim _invoiceitems As New List(Of List(Of String))
Dim _dbitems As New List(Of List(Of String))

Each List is filled like this: Example Code To fill:

_invoiceitems.Add(New List(Of String))
_invoiceitems(0).Add("Code #")
_invoiceitems(0).Add("Quantity")

Well, now i need a third list called (_changesitems) Note that this result with the differences: be the result of subtraction of quantities if this is found (dbitems - invoiceitems).

View 1 Replies

Arrays / Lists And Computing HashValues

Jun 13, 2010

I've had experience with using hashvalues from String objects. E.g., if I have StringA and StringB both equal to "foo", they'll both compute out the same hashvalue, because they're set to equal values. Now what if I have a List, with T being a native data type. If I tried to compute the hashvalue of ListA and ListB, assuming that they'd both be the same size and contain the same information, wouldn't they have equal hashvalues as well?

Assuming as sample dataset of 'byte' with a length of 5
{5,2,0,1,3}

View 3 Replies

Find A Matching Pair Of Values In Two Different Arrays?

Apr 11, 2010

How to find a matching pair of values in two different arrays? Here's the scenario:

Index Array1 Array2
0 1 3
1 2 5

[code].....

View 2 Replies

.net - Find Common Values In Several Arrays Or Lists

Dec 23, 2011

Find common values in multiple arrays with PHP Pretty much does what I need, but in PHP, I need VB. My situation is I am trying to create an intelligent stock pick system based on multiple stock locations. At the point of invoicing, we loop through the items invoiced and check the stock database for available stock.

If all items on the invoice are available to pick from stock location 1, then all should be picked from stock location 1... etc. If all most items are available from stock location 1 except one or two, then pick all stock from stock location 1 except for the exceptions which should be picked from the location with the highest available stock. Finding highest available stock is simple, but I can't work out how to analyse the stock availability from multiple locations and finding the common stock locations.

[Code]...

View 2 Replies

How To Create A Popup Dialog With Lists Of Arrays

Mar 17, 2010

I was wondering how you create a form with three lists. Each list representing a different array.

I guess the question is how do you take an array and make it into a list so it shows up on a list box?

View 2 Replies

VS 2010 Binary Search Of Arrays/Lists?

Dec 15, 2011

my binary search isnt working, i think it has to do with the fact that im using a list and its searching thru an array

List
Option Strict On
Public Class Form1

[Code].....

View 9 Replies

Join Lists Or Arrays Like Outer Joining Tables In SQL?

Jun 27, 2011

Basically what I'm having to do is create a program that takes a list of CaseIDs and compares them to a table on a remote SQL server. However, the table holding the CaseIDs on the remote server has nearly 120,000 records.

Currently my plan is to query all records on the remote server, save the query and the current list to tables in an Access DB file and then run an outer join to see which CaseIDs have no matching records on the remote server.

I believe this will be a much slower process than I would like. If I could load both queries into arrays or lists in VB and then compare them (therefore, not having to write 120,000 records to a DB file), it would be much faster.

View 10 Replies

VS 2008 - Are Arrays Considered A Type Of Collection Like Lists

Mar 2, 2010

Ever since I started using VB.Net I have been using the Generic List collection List(Of <Type>). Arrays, I haven't used so much. I used them a lot more when I wrote C code years ago.

1.) Are arrays considered a type of collection like Lists, Dictionary, Queue etc are? Or are they in their own category.

2.) Can I iterate over an array with a For Each loop like I can with other collections or do I stick with the normal For loop for arrays?

3.) There are certain methods that return arrays. Can I set a list object to hold this return value instead of an array?

View 6 Replies

Inheritance And Variety Of Data Structures Including Queues, Lists, Arrays, Or Stacks In A Windows Forms Application

Jun 27, 2012

I'd like to give a homework assignment to a person learning VB.NET. I'd like it to use basic inheritance and a variety of data structures including queues, lists, arrays, or stacks in a windows forms application. I was thinking of a pizza-ordering application. This would allow them to utilize some basic inheritance and practice using .NET UI elements.

View 2 Replies

How To Access Variables/arrays

Dec 14, 2011

Public Sub drawChart()
Dim panel As Graphics = picBox.CreateGraphics
Dim myTextBrush As SolidBrush = New SolidBrush(Color.Black)

[code].....

View 1 Replies

Session Variables And Arrays

May 18, 2011

I loading an array with data from my data base and then putting into a session Variable. I do not get any errors on that code. When I try to put the session Variable back into an array in my .aspx page I receive the following error message: [code]

View 5 Replies

Passing Arrays And Variables To A Sub Procedure?

Oct 20, 2010

I am trying to complete a homework and seem to get stuck at the last point of passing arrays and avriables to a sub to do the calculations to produce the desired result of sales tax but can;t seem to accomplish that so far.

Public
Class
frmSalestax
Dim

[code]....

View 9 Replies

VB 2k5, 2k8 - Can't Get My Variables In The Program - Into Thier Arrays

May 5, 2009

I can't get my variables in the program below into thier arrays.

Dim lblnumbers(6) As Label, txtweight(6) As TextBox
Dim txtnumbers(6) As TextBox, sngnumbers(6) As Single
Dim grade() As String, g As Integer = 1, weight() As String

[CODE]...

View 17 Replies

Reload Form And Reset All Variables And Arrays

Mar 22, 2008

My program is only one form, at a certain point I want the form to reload, and have all the variables and arrays be reset? I am able to to reload the form by:

Dim frm As Form
frm = New frmMain
frm.Show()

But the original form still stays open? My program is a version of blackjack. when who won or lost is figured out i want all the cards to clear (held in an array of picture boxes) I have random numbers generated (also put into an array) each random number then finds the image of the card it belongs too and then places it into the array of picture boxes. How to reset the arrays so I thought maybe trying to just reload the form would work?

View 4 Replies

Storing Variables In Arrays On Form Submit

Nov 22, 2009

SI have a form and on submit I need the following variables stored in array.
Dim OrderName, OrderNumber, OrderSize, OrderQuantity, OrderAddOn, OrderEachPrice, OrderTotal As String
So pretty much its an order a customer will be making and every time a new order is placed, a new array will be made.

Example:
OrderName = TextBox1.Text was Sean
OrderNumber = TextBox2.Text was 123456
OrderSize = TextBox3.Text was Large
OrderQuantity = TextBox4.Text was 2
OrderAddOn = TextBox5.Text was Pocket
OrderEachPrice = TextBox6.Text was 10
OrderTotal = TextBox7.Text was 20.00

On submit a new array would be created and would be something like this:
Dim ArrayName(,) As String = {{"Sean", "123456", "Large", "2", "Pocket", "10", "20.00"}}
BUT a new array has to be created each time the submit is clicked.

View 6 Replies

VS 2008 WithEvents - Variables Cannot Be Typed As Arrays

Jun 24, 2009

I am trying to do the following:
Public WithEvents frmButtons(999) As Button

And then use it like this:
Private Sub frmButtons_Click(ByVal sender As Object, ByVal index As Long) Handles frmButtons.Click

Where the index variable has to represent the object in the array like this:
frmButtons(index).Text="..."
But it gives me an error:
'WithEvents' variables cannot be typed as arrays.

View 4 Replies

ASP/VB Byte Arrays, Iframes, Parents, Children And Variables?

Jun 21, 2011

I have an aspx page which houses an iframe. When a button is clicked, a WCF is called to produce a PDF which is read into a byte array. I was storing the byte array in a Globals.vb file like this:

Public Shared PDF_Data as Byte()

The global was loaded from the parent aspx page like this:

PDF_Data = MyWCF.Create_PDF_File(SomeVariable)

After that, the iFrame's src was set to a blank aspx page, which had the following code in the page_load event:

'Write the PDF binary data to the screen (viewer)
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/pdf"
Response.BinaryWrite(Globals.PDF_Data.ToArray)

However, realizing that this application will have several users who will get different PDF documents, I have learned that this is not the way to go. My shared variable would be accessible to all users, a big no-no.However, I am stumped as to how I'm going to store the byte array and make it available to a child aspx page from it's parent.

View 1 Replies

Saving Multiple Arrays And Variables To Encrypted File?

Mar 29, 2011

I'm looking to be able to save and load the content from multiple structured arrays and variables into/from an encrypted file, is there any reliable source of information or tutorial that I'd be able to use for this? I've never written a program in visual basic that writes to/reads from a file.

I'm using microsoft visual studio 2008.

View 4 Replies

Sorting 2 Lists Based On Only One Of The Lists?

Apr 1, 2011

I have two lists. One list is a list of names, the other list is a list of how many times each name is found in the first list noted in the database

so...
Nick
John
Jim
Jack

is the firs tlist

10
13
13
2

is the second list. Nick had 10, john 13 and so on.I want to sort the second list from large to small, but have the index for the first list still linked to the correct amount of calls.i do it this way so I can

for x = 0 to num_of_names
string = lst_name(x) & "-" & lst_count(x)
next x

View 3 Replies

Know If An Array Of Lists Contains Similar Items (similar Lists)?

May 20, 2010

I know how to check whether an item exists in a list using (MyList.Contains), But I do not know how to check the whole list. For example (use one button and one richtextbox):

[Code]...

View 14 Replies

VB6 Used Recordsetsor Arrays - .Net Framework In VB2010. Datasets, Dataviews. Tableadapters, Arrays. Enums ?

May 9, 2010

In VB6 I load a recordset containg all of the records (6 fields per record)in a table into an XArray and then manipulate the records in the array and then write them back to the original table. The array issorted by the first field (1 to maybe 8000 or more) I need to find records in the array by an ID field and then move them (because of some external criteria that happens many times) from say number 400 to number 375. Then all of the other records between 375 and 399 were renumbered up 1 to fill the gaps left by the move.

The XArray worked well as it could find and also move to a next record easily to facilitate the revisions to each record quickly. Everything is done in VB6 in code and nothing visual needs to be shown to the user until say 2000 of these external changes are complete. What is the best, most efficient way to do this in the .Net framework in VB2010. Datasets, Dataviews. tableadapters, arrays. enums ?

View 3 Replies

Integer Arrays - User Enter In Big Integers Using - Two Parallel Arrays

Dec 10, 2009

My assignment is to have a user enter in big integers using what i think is two parallel arrays. I got this far but now im stuck. I think i need to actually convert the text box input into an array but i do not know how to do that. I am all over the place in this project.

'Created/ Revised by: Jessica Falcetta
'Cap 204 Final Project: Big Integer Project
'Project Purpose: To calculate large integers through parallel arrays

[CODE]...

View 5 Replies

Passing Arrays Through Fortran Dll From App Turning To Single Element Arrays?

Feb 2, 2010

I have a VB.net console app and I am opening a function in a dll written in fortran. I am passing 3 arrays through the function by reference. When they come back out the otherside they ahve all tunred to arrays of only one element And that element is 0.I read on the internet somewhere that when doing this kind of thing it is a good idea to only pass the first element of the array into the function.I tried changing my function declaration to accepting single elements rather than single dimensional arrays, and now the arrays are the same length before and after the function call, but they don't seem to be changing at all, so i'm not sure that this is working

View 1 Replies

VS 2008 Arrays Displaying States/searching Arrays?

Oct 30, 2010

the statement Dim state(49) As String and maintain a list of certain states. The list of states should always be in alphabetical order and occupy consecutive elements of the array. The buttons in the program should give the user the following options: (a) Take the state specified by the user in a text box and insert it into its proper position in the array. If the state is already in the array, so report. (b) Take the state specified by the user in a text box and delete it from the array. If the state is not in the array, so report. (c) Display the states in the array. "

Private Sub states_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
state(0) = "Alabama"

[code]....

View 1 Replies

Comparing Arrays :: Possible Without Iterating The Arrays?

May 3, 2010

I was wondering if anyone knows a built in method ( LINQ say or a LAMBDA expression or other way ) that you can compare2 arrays - collections that would be valid for an equivalent 3rd array - collection which is a combination of the 1st two.

As an example consider;
* * *
A L E

[code].....

View 17 Replies

Sort Three Arrays (the Other Two Arrays Are In Sync With The First)?

Oct 13, 2009

How can I sort three arrays so they are sorted together (the other two arrays are in sync with the first)?unsorted unsorted unsortedarray1]CODE]....

View 9 Replies

VS 2008 - Take A String Of Variables With A Common Delimiter And Break It All Back Out Into Separate Variables

Dec 11, 2011

Last year (2010) I came across a FANTASTIC command that allowed me to take a string of variables with a common delimiter and break it all back out into separate variables (possibly an array) with one statement.

[Code]...

As long as the delimiter was a unique specifiable character, this one-statement command could break it out into elements. my memory and point me in the right direction.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved