Hi, I have 2 arrays (Each As a String), and I would like to combine these into a new single array. Is there an easy way of coding this? For example, I want "arrData" and "arrID" to be combined into a new array: "arrTotal". If anyone could give me some coding examples, I'd greatly appreciate it. Thanks!
9 24129
Hi, I have 2 arrays (Each As a String), and I would like to combine these into a new single array. Is there an easy way of coding this? For example, I want "arrData" and "arrID" to be combined into a new array: "arrTotal". If anyone could give me some coding examples, I'd greatly appreciate it. Thanks!
This has a ArrayMerge solution that might be just what you need: http://www.freevbcode.com/ShowCode.Asp?ID=2874
Hi, I have 2 arrays (Each As a String), and I would like to combine these into a new single array. Is there an easy way of coding this? For example, I want "arrData" and "arrID" to be combined into a new array: "arrTotal".
Can you be more speciifc about what you mean by "merged"? Do you want the corresponding values in the arrays to be concatenated/added/multiplied/combined in some way? Do you just want the two arrays to be stuck together "end to end"? Should the values be "interleaved"? Show us some samples of what sort of thing you mean.
Also, what version of VB are you using?
Thanks for your replies. I'm using VB 6.0. I basically am building 2 separate "tables" that are being filled with data from a SQL table. The first array bascially contains descriptive data and the 2nd array contains numerical quantitative data. I'm adding SQL data into each array using .movenext and loop. So, I have both arrays containing the data, and I would like to combine them as a new "table". So, nothing will be added or calculated, just a combined new array that contains all the data. Thanks!
Hi,
u want a combined resultant array with Distinct Values of both the arrays..? or Simply Merge without any condition...?
If both the array data is in 2 Tables, then u can just get the Results thru SQL Query, u dont have to Populate an array and combine,
Some Query Like : -
Select Col1 From Table1
-
Union All
-
Select Col1 From Table2
-
REgards
Veena
Hi,
u want a combined resultant array with Distinct Values of both the arrays..? or Simply Merge without any condition...?
If both the array data is in 2 Tables, then u can just get the Results thru SQL Query, u dont have to Populate an array and combine,
Some Query Like : -
Select Col1 From Table1
-
Union All
-
Select Col1 From Table2
-
REgards
Veena
Onemore Guesses -
SELECT (tblTableName1.MrgColumn & tblTableName2.MrgColumn) as CombColumn
-
FROM tblTableName1 INNER JOIN tblTableName2 ON tblTableName1.IDfield = tblTableName2.IDfield
Just explain you want to ADD one by one or merge columns?
I'm still a bit confused about what is to be in the combined array. Could you show us just a little sample of some data, before and after.
If the "combined" array is supposed to hold some sort of one-to-one relationship (this descriptive-text <=> this numeric-value) then perhaps the simplest would be to define an array (or collection) of a user defined type which holds the two pieces of information. For example... - Public Type MyStuff
-
DescTxt As String
-
NumVal As Long
-
End Type
-
Dim MyArray(1 To 10) As MyStuff
-
-
With MyArray(1)
-
.DescTxt = "The first descriptive text entry"
-
.NumVal = 1234
-
End With
-
-
' And so on...
@Killer42
I think He Means...
Dim 1 = abc
Dim 2 = def
3 should be 1 joined to 2 so...
3 = abcdef
-
'testing.. :)
-
-
'under general declarations
-
Dim arr1(),arr2(),arr3() As String
-
Dim i,n As Integer
-
-
'let rs handles the recordset
-
-
'sub to get records then add to a listbox
-
rs.Requery
-
n = rs.RecordCount
-
Redim arr1(1 To n)
-
Redim arr2(1 To n)
-
Redim arr3(1 To n)
-
-
i = 1
-
Do Until rs.Eof
-
arr1(i) = rs!ID
-
arr2(i) = rs!Name
-
arr3(i) = arr1(i) & " " & arr2(i)
-
i = i + 1
-
rs.MoveNext
-
Loop
-
-
For j = 1 To i
-
List1.add arr3(j)
-
Next j
-
You may be right waffles. However, it may also be a bit late. That last post of mine was almost 5 years ago, and the OP doesn't appear to have been active here for almost that long.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Troll |
last post by:
Hi,
I need to write a script which reads some data and reports the findings.
Just to give you an idea the structure is similar to the following.
Data input example:
HEADING 1
**********...
|
by: csx |
last post by:
Hi everyone!
two quick questions relating to arrays.
Q1,
Is it possible to re-assign array elements?
int array = {{2,4}, {4,5}};
array = {2,3}
|
by: JL_327 |
last post by:
No one on any of the other boards seem to know
In VB.Net this late binding works fine
Dim Version As Integer
Dim Revision As Integer
Dim Wnum As Integer
Dim o As System.Array =...
|
by: frekster |
last post by:
Hi.
I used to be able to do this easily in vb 6 via looping and preserving
the source array data/size etc.
How can I do this in vb.net? I've been trying for a while now and this
should be...
|
by: Schroeder, AJ |
last post by:
Hello group,
I am a relative PHP newbie and I am trying to combine two arrays together,
but I also need to keep the keys of one array intact. What I am doing is two
SNMP walks against a Cisco...
|
by: chris |
last post by:
I have a few byte arrays that I would like to combine into one array
(order needs to be kept). What would be the most efficient way to do
this?
Thanks for your time,
Chris
|
by: Doug_J_W |
last post by:
I have a Visual Basic (2005) project that contains around twenty
embedded text files as resources. The text files contain two columns
of real numbers that are separated by tab deliminator, and are...
|
by: cmdolcet69 |
last post by:
I know have (2) seperate arrays that hold an undefined number of information. I would like to take array-1 and array-2 and create an average array between the two
array1 ...
|
by: macca |
last post by:
Hi,
I'm doing an two ldap_search queries and I need to combine the two
results into one single array containing all the results from each but
removing duplicates.
I have tried built in php...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |