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 24198
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 "interleave d"? 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!
QVeen72 1,445
Recognized Expert Top Contributor
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
**********
ColumnA ColumnB ColumnC ColumnD ColumnE
|
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 = System.Array.CreateInstance
(GetType(Single), 1)
|
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 an easy task but it just isn't clicking.
For some reason, the preserve doesn't seem to be working.
|
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 router in which I expect the script to return the
interface number along with a small description of the interface type, like
this:
Array
(
| |
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 of
different lengths (e.g. usually between 25 and 45 rows. The columns in
each file have the same length). The text files have been numbered
sequentially e.g. cb0, cb1, cb2 and so on. I would like to read the
data from each text file into...
|
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 array2 arrayAVG
4096 4095 4095.5
4071 4012 4041.5
4000 3812 ...
|
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 functions such as array_merge (which gives
me duplicates) and array_unique which does not work either.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |