M
Martin Eyles
Hi,
I am getting a string passed back from a web form in the format
name1:variable1;name2:variable2...
I would like to split this up into several variable, such that the variable
names are name1, name2 etc. (I actually know what these names are) and the
values of the variables are variable1, variable2 etc.
I tried using split to split the string into an array at the semicolons, and
was then thinking I would split the value out with a second split command,
but this seems a bit of a complex way round the problem. Also I am having
some problems with the implementation.
My two questions are:
1. What is wrong with the code as it stands
2. What better way is there of acheiving the desired effect
My VB.NET code behind is something like:
'Declare Variables
Dim DataString As String
Dim DataArray(9) As String
'Get Data from http
DataString = Request("DataString")
'Parse Data
DataArray = TimeEntryData.Split(CChar(";")) 'This is the line that gives an
error
name1=TimeEntryDataArray(1)
Response.Write(name1)
And the Error I get is:
Object reference not set to an instance of an object.
Thanks,
Martin
I am getting a string passed back from a web form in the format
name1:variable1;name2:variable2...
I would like to split this up into several variable, such that the variable
names are name1, name2 etc. (I actually know what these names are) and the
values of the variables are variable1, variable2 etc.
I tried using split to split the string into an array at the semicolons, and
was then thinking I would split the value out with a second split command,
but this seems a bit of a complex way round the problem. Also I am having
some problems with the implementation.
My two questions are:
1. What is wrong with the code as it stands
2. What better way is there of acheiving the desired effect
My VB.NET code behind is something like:
'Declare Variables
Dim DataString As String
Dim DataArray(9) As String
'Get Data from http
DataString = Request("DataString")
'Parse Data
DataArray = TimeEntryData.Split(CChar(";")) 'This is the line that gives an
error
name1=TimeEntryDataArray(1)
Response.Write(name1)
And the Error I get is:
Object reference not set to an instance of an object.
Thanks,
Martin