I am trying to figure out a way to change the below code to store data
in a multidemensional array rather than a listbox. The reason being is
I need to be able to pull each "currentrow" and manipulate the
position of each "currentfield" to then imput this data to another
source as a string. The delimited text might look like the following.
acctno, name, expdate,cr_line
4428123456789012,smith,0807,5000
4428123456789025,williams,0908,15000
I then would need to manipulate this into a string like this.....
NM*014*4428123456789012*0807
I have no trouble with the NM*014* pieces as these would be constants
but thought if I could put these items into a multidimensional array I
could call them out easier within a for next loop.
Like this.....
dim output as string
output = "nm*014*' & acct(1,0) & "*" & acct(1,2)
........So any help in accomplishing this would be VERY Helpful.
Private Sub LoadCommaDelimetedTextFileIntoListBox(ByVal filePath As
String)
Dim theTextFieldParser As TextFieldParser
theTextFieldParser =
My.Computer.FileSystem.OpenTextFieldParser(filePat h)
theTextFieldParser.TextFieldType =
Microsoft.VisualBasic.FileIO.FieldType.Delimited
theTextFieldParser.Delimiters = New String() {","}
Dim currentRow() As String
Try
While Not theTextFieldParser.EndOfData
currentRow = theTextFieldParser.ReadFields()
Dim currentField As String
For Each currentField In currentRow
Me.ListBox1.Items.Add(currentField)
Next
End While
Catch malFormLineEx As
Microsoft.VisualBasic.FileIO.MalformedLineExceptio n
MessageBox.Show("Line " & malFormLineEx.Message & "is not
valid and will be skipped.", "Malformed Line Exception")
Catch ex As Exception
MessageBox.Show(ex.Message & " exception has occurred.",
"Exception")
Finally
theTextFieldParser.Close()
End Try 1 1600
I don't think I read the question fully but you want to split string
variable s delimited by comma
into array
dim sArray as String[]
sArray = s.split{",")
I am sure you figure out how to use this tidbit to plug in the value into
you multi-dimensional array if you still think that is the best way.
"Necromis" <tf******@pscufs.comwrote in message
news:11**********************@w5g2000hsg.googlegro ups.com...
I am trying to figure out a way to change the below code to store data
in a multidemensional array rather than a listbox. The reason being is
I need to be able to pull each "currentrow" and manipulate the
position of each "currentfield" to then imput this data to another
source as a string. The delimited text might look like the following.
acctno, name, expdate,cr_line
4428123456789012,smith,0807,5000
4428123456789025,williams,0908,15000
I then would need to manipulate this into a string like this.....
NM*014*4428123456789012*0807
I have no trouble with the NM*014* pieces as these would be constants
but thought if I could put these items into a multidimensional array I
could call them out easier within a for next loop.
Like this.....
dim output as string
output = "nm*014*' & acct(1,0) & "*" & acct(1,2)
.......So any help in accomplishing this would be VERY Helpful.
Private Sub LoadCommaDelimetedTextFileIntoListBox(ByVal filePath As
String)
Dim theTextFieldParser As TextFieldParser
theTextFieldParser =
My.Computer.FileSystem.OpenTextFieldParser(filePat h)
theTextFieldParser.TextFieldType =
Microsoft.VisualBasic.FileIO.FieldType.Delimited
theTextFieldParser.Delimiters = New String() {","}
Dim currentRow() As String
Try
While Not theTextFieldParser.EndOfData
currentRow = theTextFieldParser.ReadFields()
Dim currentField As String
For Each currentField In currentRow
Me.ListBox1.Items.Add(currentField)
Next
End While
Catch malFormLineEx As
Microsoft.VisualBasic.FileIO.MalformedLineExceptio n
MessageBox.Show("Line " & malFormLineEx.Message & "is not
valid and will be skipped.", "Malformed Line Exception")
Catch ex As Exception
MessageBox.Show(ex.Message & " exception has occurred.",
"Exception")
Finally
theTextFieldParser.Close()
End Try This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Golf Nut |
last post by:
I am finding that altering and affecting values in elements in
multidimensional arrays is a huge pain in the ass. I cannot seem to find a
consistent way to assign values to arrays. Foreach would...
|
by: Terry |
last post by:
Hi,
can someone plz tell me how multidimensional arrays (like a 2-D array)
are stored in memory? Are they like single dimensional arrays? Stored
sequentially in one "row", so to say?
Thanks
...
|
by: Charles Banas |
last post by:
i've got an interesting peice of code i'm maintaining, and i'd like to
get some opinions and comments on it, hopefully so i can gain some
sort of insight as to why this works.
at the top of the...
|
by: Claire |
last post by:
I have a multidimensional array defined as
private double myArray = new double;
The first column of the array contains X values, the other contains Y values
I have a charting function defined as...
|
by: Ravi Singh (UCSD) |
last post by:
Hello all
I am trying to use jagged and multi-dimensional arrays in C++.
In C# these work fine
// for jagged arrays
string jaggedArray = new string ;
//for multidimensional arrays
string...
| |
by: utab |
last post by:
Hi there,
Is there a way to convert a double value to a string. I know that there
is fcvt() but I think this function is not a part of the standard
library. I want sth from the standard if...
|
by: |
last post by:
I'm fairly new to ASP and must admit its proving a lot more unnecessarily
complicated than the other languages I know. I feel this is because there
aren't many good official resources out there to...
|
by: oopsatwork |
last post by:
Ok...so, I have been outside of the C world for a _very_ long
time...but not so long as to remember how to do multidimensional
arrays. So, let me state that I know how to malloc pointers to...
|
by: Slain |
last post by:
I need to convert a an array to a multidimensional one. Since I need
to wrok with existing code, I need to modify a declaration which looks
like this
In the .h file
int *x;
in a initialize...
|
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: 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,...
| |
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: 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...
|
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,...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |
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...
| |