473,387 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Array troubles

Hi all
This is my first post. I`ve looked back at the previous array discussions and haven`t found an answer to my problem so apologies if I am re-asking something that has already been asked in the past.

I have the following function in a .net class:

Public Shared Function ReturnAll(ByVal odfpath As String) As String()
Dim ReturnArray(1) As String
Dim returntext As String = ""
Dim c() As String = Nothing
Dim i As Integer = 0

If IO.File.Exists(odfpath) = True Then

Dim sr As New StreamReader(odfpath)
Dim line As String = sr.ReadLine()
Do While sr.Peek <> -1
c = line.Split("=")
If c.GetUpperBound(0) = 1 Then
ReturnArray(i) = c(0)
i += 1
ReturnArray(i) = c(1)
i += 1
Return ReturnArray
c = Nothing
ReturnArray = Nothing
Exit Function
End If
line = sr.ReadLine

Loop
ReturnArray(0) = "ERROR1: NO Match Found"
Return ReturnArray
Else
ReturnArray(0) = "ERROR2: NO Match Found"
Return ReturnArray
End If

End Function

Basically, the function looks at a text file and reads in, splits, and enters into ReturnArray any line that looks like this: property = value

The function is being called from the main form like this:
TextBox4.Text = ReturnAll(TextBox2.Text)

The thing I cannot figure out is how to handle the array when it is returned back to the main form so that I can access both items in the array.
The array will always have 2 entries - the text before the = and the text after.

I have tried creating another array and having that call the ReturnAll function as so:

dim array(1) as string
array() = ReturnAll(TextBox2.Text)

but it just comes up with the following error, as does the main form code above: Value of type '1-dimensional array of String' cannot be converted to 'String'.


If anyone can help me solve this problem that would be greatly appreciated as i`ve been trying to get it work for 3 hours now and it is doing my head in! :-)

hermiod
Dec 29 '06 #1
0 847

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: vcardillo | last post by:
Hello all, Okay, I am having some troubles. What I am doing here is dealing with an employee hierarchy that is stored in an array. It looks like this: $employees = array( "user_id" => array(...
6
by: max reason | last post by:
A method in one of my classes needs to call one of 256 other methods in the same class based on an unsigned 8-bit value (0x00 to 0xFF). How is this done? Everything I try generates errors. ...
4
by: Tom Page | last post by:
Hello all I have a question that may or may not be simple - I need my three dimensional array to be of the form: array where jj and kk range from 0 to some constant fixed at the very...
4
by: Svetoslav Vasilev | last post by:
Hi, I experience some troubles trying to convert an object,returned by a DataTable for a field value to its actual representation of Byte. The field values in a DataTable as we all know are returned...
104
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from...
8
by: zulander | last post by:
is there a way to find out if the element exist ? dim myarray() as string dim mytxt as string mytxt ="Superman1,Superman2,Superman3,Superman4" myarray=mytxt.split(",") ...
5
by: xxx | last post by:
Hi all, i'm new in visual c++ and i'm having troubles converting types. Let me explain: i have an unmanaged c++ function that wants an float* parameter but i have an array<float>^, how i can covert...
12
by: Martien van Wanrooij | last post by:
I have been using for a while a class to create photo albums. Shortly, an array of photo's is declared, initially they are shown as thumbnails, by clicking on a thumbnail a larger photo is shown...
7
by: dmitrey | last post by:
howto make Python list from numpy.array? Thx, D.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
Oralloy
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.