By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,846 Members | 1,631 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,846 IT Pros & Developers. It's quick & easy.

Error:Value of type 'String' cant be converted to 1-dim array of L

P: n/a
Hi,

I am getting the error: Value of type 'String' cannot be converted to
'1-dimensional array of Long'.

in the following line for TextBox2.Text field :

doc.LoadXml(EDP.ExportPositions(TextBox1.Text,
cmbStartDateandTime.SelectedText,
cmbEndDateandTime.SelectedText, TextBox2.Text)))

Actually, I have a webReference to ExportData.asmx file. Here, Assets
column has datatype as Long. Since the textbox I
created for Assets label has datatype string, this
is causing the problem.

I tried all conversion types but it doesn't work. I appreciate your quick
help and thanku in advance.
Feb 21 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
clng(TextBox1.Text) should do
"XML newbie: Urgent pls help!"
<XM********************@discussions.microsoft.co m> wrote in message
news:92**********************************@microsof t.com...
Hi,

I am getting the error: Value of type 'String' cannot be converted to
'1-dimensional array of Long'.

in the following line for TextBox2.Text field :

doc.LoadXml(EDP.ExportPositions(TextBox1.Text,
cmbStartDateandTime.SelectedText,
cmbEndDateandTime.SelectedText, TextBox2.Text)))

Actually, I have a webReference to ExportData.asmx file. Here, Assets
column has datatype as Long. Since the textbox I
created for Assets label has datatype string, this
is causing the problem.

I tried all conversion types but it doesn't work. I appreciate your quick
help and thanku in advance.

Feb 21 '06 #2

P: n/a
I already tried this. but, it didn't work. Actually, Assets column is stored
as 1 dimensional array of Long in the database.

I wrote a function to do this:
Public Sub StringToArray(ByVal sThisString As String, ByVal asResults() As
Long, Optional ByVal sDelimRows As String = "ae", Optional ByVal sDelimCols
As String = "[]")

Dim lPos1dDel As Long, lLenString As Long, lColSepLen As Long
Dim lLastPos As Long, lThisRow As Long, lNumCols As Long, lThisCol
As Long, lRowSepLen As Long
lLenString = Len(sThisString)
If lLenString Then
lLastPos = 1
lPos1dDel = InStr(1, sThisString, sDelimRows)

'Dim StringCount As Integer 'The number of strings to output
'lNumCols = StringCount(sThisString, vbTextCompare)
lRowSepLen = Len(sDelimRows)

'If Not lNumCols Then
'Convert a 1D string
'Create buffer to store results
ReDim asResults(0 To Int(lLenString - 1 / 2))
lPos1dDel = InStr(lLastPos, sThisString)
Do While lPos1dDel
lThisRow = lThisRow + 1
asResults(lThisRow) = Mid$(sThisString, lLastPos, lPos1dDel
- lLastPos)
lLastPos = lPos1dDel
lPos1dDel = InStr(lLastPos, sThisString)

Loop
ReDim Preserve asResults(0 To lThisRow)
When I call asResults() in the following line, I get the error: Number of
indices is less than the number of dimensions of the indexed array

doc.LoadXml(EDP.ExportPositions(TextBox1.Text,
cmbStartDateandTime.SelectedText, cmbEndDateandTime.SelectedText,
asResults()))

"Onawole, Clement Oladapo" wrote:
clng(TextBox1.Text) should do
"XML newbie: Urgent pls help!"
<XM********************@discussions.microsoft.co m> wrote in message
news:92**********************************@microsof t.com...
Hi,

I am getting the error: Value of type 'String' cannot be converted to
'1-dimensional array of Long'.

in the following line for TextBox2.Text field :

doc.LoadXml(EDP.ExportPositions(TextBox1.Text,
cmbStartDateandTime.SelectedText,
cmbEndDateandTime.SelectedText, TextBox2.Text)))

Actually, I have a webReference to ExportData.asmx file. Here, Assets
column has datatype as Long. Since the textbox I
created for Assets label has datatype string, this
is causing the problem.

I tried all conversion types but it doesn't work. I appreciate your quick
help and thanku in advance.


Feb 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.