Jagged 3 Dimension Array Versus Lists?
Oct 18, 2011
i have used in vba 3 dimensional jagged arrays where i had up to 10000 rows. i am now transferring this to vb.net and learnt that it would be better to work with lists. the dimensions are such as (30, 10000, 30). how would i structure this by using lists?
View 8 Replies
ADVERTISEMENT
Sep 7, 2010
I've managed to make some single dimension array lists but I can't figure out a multi dimension arraylist.
Here's what I'm trying to do:
I have a database (mdb) with 5 columns that I want each row to be in an array list.
In PHP what I'd typically do is:
$array[$field1] = array($field2,$field3,$field4,$field5);
How I do the same in vb.net so anytime I need to fetch an item for a specific for the row1 I could call it?
For a single dimension I could do the following, but I can't figure out how to add more fields to a single array row:
Dim tmpArrayX As New ArrayList
tmpArrayX.Add(field(0))
tmpArrayX.Add(field(1))
etc...
View 1 Replies
Feb 5, 2009
I have an one dimension string array ar1
ar1(0) ="One;is;a;dog;"
ar2(1)="Two;is;a;cat;"
...
I want to convert ar1 into ar2 which is a two dimension array
ar2(0)(0)="One";ar2(0)(1)="is";ar2(0)(2)="a";ar2(0)(3)="dog"
etc
View 4 Replies
Jan 7, 2010
I have an requirement where I want to create a jagged array out of datatable and pass the jagged array over WCF.
Dim ObjJaggedArray(15)() As String
For Each row As DataRow In ObjTables.Tables(pKeyName).Rows
Try
'I DONT KNOW THIS PART
[code]....
View 8 Replies
Jan 25, 2011
I have a text file called COUNTERS_SETTINGS.DAT having the following contents:
[USERID]<=>COUNTER_1
[PASSWORD]<=>ADMIN1
[CONNECT_STRING]<=>DATA SOURCE=RECAT;USER ID=PAYOPER;PASSWORD=PAYOPER
I'm Trying to have that entries in a Jagged array of Strings like this
Array Name is : Core (2,1)
Core
(0) (1)
(0) USERID | COUNTER_1
(1) PASSWORD | ADMIN1[code]........
View 3 Replies
Sep 21, 2010
I'm working on a reporting section of code for an inventory app I'm making for my office.I call a text file, read every line into an array then populate information pages with what has been pulled from the text file.For reporting, I want to read every text file in the directory, reading each one into a multidimensional array.Thus I can call and report on each item, i.e.ItemArray(i,2) would be all systems with Windows 2008 EE..I have code that lists all files in the desired directory and counts each file, so I eventually get counts of how deep I need the first level of the jagged array to be. but not until after code execution. Basically how can I write each array of data to the jagged array.[code]But I get a null reference exception. "Use the new keyword to create an object instance".
View 8 Replies
Mar 1, 2010
I currently have a VB.NET dll that returns a jagged array of double. This is the declaration:
Public Function CalcMatching(ByRef dataArray1 As Object,
ByRef dataLen1 As Integer, ByRef dataArray2 As Object,
ByRef dataLen2 As Integer, ByRef matchingType As String) As Double()()
It works well inside VB.NET, but when I insert it into a VBA project, I noticed that after the execution of the funtion, while retrieving the data, the "Type mismatch' excpetion is raised inside VBA.I searched over the internet, but I could not find a delcaration of a jagged array inside VBA. is that possible? If yes, how can I do it?
View 1 Replies
Mar 16, 2011
Dim strTest(recordSet.Count)() As String[code]...
Then once the array i populated above, i need to find the if another variable is contained in the second dimension of the second paren contains the value of my variable like this.[code]...
View 2 Replies
Mar 26, 2012
I am trying to make a jagged array that has,
3 columns
with 5,4,4 rows respectively
that each have 2 rows
that have a varying number of rows, for example 6,9,5,6,4 I have the first part setup but I don't know how to get to another level of the jagged array.
Dim potentialStructure()() As Short = {New Short() {0, 1, 2, 3, 4}, New Short() {0, 1, 2, 3}, New Short() {0, 1, 2, 3}}
And how would I access an element at say, the lowest level?
View 1 Replies
Feb 12, 2012
I need to scan database and insert its values into an array. But I'm having some difficulties in handling null values and array.
The database looks like this:
0 1 2 3 4
30 31 32
33 34
36 37 38 39 40
38 39 47 48
I want to make array rr_item which gonna looks like this:
arr_item(1)={0,1,2,3,4}
arr_item(2)={30,31,32}
arr_item(3)={33,34}
arr_item(4)={36,37,38,39,40}
arr_item(5)={38,39,47,48}
Every code I've tried result in error everytime I tried to insert null value into any kind of c=variable, including array which I want to use. And I'm not quite sure with what I'm doing in jagged array I want to build.
sql_list = "SELECT * FROM retail"
oledbCnn = New OleDbConnection(connetionString)
Try
oledbCnn.Open()
[Code] .....
View 5 Replies
Dec 13, 2010
Okay I'm tring to make a fairly simple class
[Code]...
View 2 Replies
Oct 2, 2009
how do i declare jagged array? it has 7 elements consisting of 2 to 8 elements consisting of 3 elements.[Code]
View 1 Replies
Dec 15, 2010
I am trying to loop through a jagged array and keep getting an exception.
Dim jagged()() As Integer = New Integer(1)() {}
Dim test() As Integer = {1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7}
For i As Integer = 0 To 1
[code]....
View 9 Replies
May 1, 2011
How do I use only one dimension of an array? What I have going on is: I have an array suit(1, 4) and rank(1, 13) to represent a deck of cards. What I want to do is take the value of the rank of the selected item in my listbox to be able to add it to the rank of other selected items in the listbox (essentially adding the players hand together). [code]...
View 5 Replies
Jan 21, 2010
I have a question with jagged array, every element can contain strings, be empty or be nothing.
I would like to create a jagged array and put some strings into its cells.
Public Sub S1 ()
Dim MyArr(7)() As String ' OK
MyArr(1) = New String(8) {} ' OK the second cell contains 9 subcells
[Code].....
View 5 Replies
Oct 17, 2011
So I have a function that looks up values in a jagged array, and it goes like this:
Private Function Lookup(ByVal Search_path As String) As Integer
Dim i As Integer = 0
Do Until MasterIndex(i) Is Nothing 'throws an exception here
[Code]....
Problem is, when I test this with an empty array, it gives me the error of Index was outside the bounds of the array at line 3. How do I fix this?
View 2 Replies
Oct 15, 2009
I have a scenario where I am trying to generate every combination of value from a jagged array - for example..[code]So all in first array associated with all in second array.I have created my jagged array with the values but I can't work out how to iterate through it and create all variations - I can iterate, but only get each value once at present.Also on a related note this could do with working in the case of more than 2 arrays - i.e. a multiple number of arrays within the jagged array.
View 3 Replies
Apr 4, 2012
Can we make function which return jagged array? If so, could u give example of it?
View 2 Replies
Jan 12, 2010
I am having trouble conceptualizing how to create and load my 3d Array. The Project does the following:
View 6 Replies
Nov 3, 2011
I had insert value from datagridview to array
but how to make the array become for loop function?
Dim rowNo As Integer = 0
counter = dgv.RowCount()
[code].....
View 5 Replies
Feb 26, 2010
I have an application in VBA that gives to my VB.Net dll one bi-dimensional variant. It is a an array, in which every component is a another array containing two positions.
I want to get this two-position array. When I am using VBA I can access directly the data from each position by doing:dataArray(index, 0) or dataArray(index, 1)And when I want to get the two-position array I can use:
Dim posArray as variant
posArray = dataArray(index)
[Code]...
View 1 Replies
Mar 28, 2011
Public Property TabsCollection()() as String()()
Get
Return _tabsCollection
End Get
[code]....
but it errors saying: End of statement expected.
View 3 Replies
Mar 13, 2010
I have a jagged array.
vb
Dim jaggedarray(numColumns)()
Does this accept multiple data types?
I'm trying to get the results of a SELECT SQL query from Data.OleDb.OleDbDataReader.Item Are there any better ways of approaching this?
View 2 Replies
Oct 6, 2010
I need to add an additional dimesion to outputArrayOfBits() in the code below which I hope conveys my intention. I need to convert a one dimensional array of 1 to n boolean (bit) values into arrays that group them by 8's so the output can be consumed by someone needing these values to be in hex format (0000 1111) = 0F How do I change the declaration of 'outputArrayOfBits and the nested control loop to achieve that?
Dim inputArrayOfBits As New BitArray(32, True) ' I can't change this.
'Create array of bytes containing what will be sent out has hex numbers 0 - F
'outputArrayOfBits(0) = (1,1,1,1,1,1,1,1) 'Hex value FF
[code]....
View 11 Replies
Apr 21, 2011
I need to manipulate data for 1000 boxes, each one of these boxes has 8 variables.How to declare an appropriate array? and how to load the array with the 8 variables for each box?
View 20 Replies
Feb 20, 2011
I am trying to create a multi dimension array that will search each row of the array and total up the number of 0's 1's, 2's, and 3's. I believe that I need to create some sort of looping structure that will search through each row of the array.I have created a listbox that will allow the user to pick which row of the array the program will search.This is what I have created so far, but I am only just learning and I am having trouble wrapping my head around how arrays work. So I'm not sure if I am on the right path or not.
Dim racescores(,) As Integer = {{0, 1, 0, 3, 2},
{1, 0, 2, 0, 0},
{0, 3, 0, 1, 0},
[code].....
View 3 Replies
Jun 22, 2011
I'm trying to return changes to array data, including redimensioned arrays, from within a function call in code similar to:
fault = MyFunction(Array1, Array2)
Public Function MyFunction(ByVal inObj1 as UserStruture(), ByVal inObj2 and Integer(,)) as String
Dim myResult as String = "Failed"
Dim tmpStruct() as UserStructure = inObj1
[Code] .....
This works fine in updating the input array 'Array1', only when the redimensioning of tmpStruct is NOT performed. After redimensioning tmpStruct, the redimensioned array is passed back successfully into 'inObj1' within the function 'MyFunction', but is not passed out of the function call; i.e.
fault = MyFunction(Array1, Array2) -
The dimension of array 'Array1' out of the function call remains as it was before the function call. However, the data change; i.e.
tmpStruct(0).Nam = "New Name"
is passed successfully out of the function call.
Why the Redim operation is not passed back out of such function calls. I would like to return changes to arrays 'Array1' and 'Array2', plus a result string from the function call if I can. Furthermore, I would also like to change the dimension of the array within the function call, if required, and return the complete redimensioned array back out of the function call.
View 4 Replies
May 13, 2010
I have the following array in my project that I'm trying to redim without losing the values.The problem with redim preserve is I can only redim the last dimension of the array. I want to redim the 2nd dimension without losing data. How do I get this to work?[code]
View 11 Replies
Jun 29, 2010
I am trying to split an array into a jagged array for easy manipulation, but I am having a bit of trouble with the Copy method of Array.This is what I have:
Dim masterData()() As String = New String(splitCounter.Count - 1)() {}
For i As Integer = splitCounter(0) To splitCounter.LastIndexOf(splitCounter)
Array.Copy(ServerResponse, splitCounter(i), masterData(i) = New String(), i, splitCounter(i
[code]....
View 2 Replies
Jun 14, 2012
Recently I started a project with the goal being to have text that was inputted into a textbox stored within a three dimensional jagged array. The idea is that every time a button is pressed, whatever text that is inputted into the textbox is split into separate elements, where each word occupies its own element in the array. So for example, if a poem were entered into the textbox and the button clicked, each word of the poem would be assigned to a discrete element in the vertical dimension, and each line of the poem assigned an element in the horizontal dimension. After the text is stored into the 3D jagged array, the text should be cleared from the textbox and a counter should then ensure that on the next button press, the new text inputted into the textbox is stored in a discrete element of the array. Below is the code I have written so far, but I know that I am far from having anything might accomplish what I have just described.
[Code]...
View 9 Replies