|
-
Oct 3rd, 2021, 05:17 PM
#1
Thread Starter
Lively Member
Identical Split() call works fine in one program but not in another
I have a test line in a VB program:
Code:
Dim testArray() As String = Split("ab\c\d", "\")
which I copied more or less straight from a Visual Basic reference.
It works fine in one program, but in another I get the error message:
Error BC30519 Overload resolution failed because no accessible 'Split' can be called without a narrowing conversion:
'Public Overloads Function Split(ParamArray separator As Char()) As String()': Argument matching parameter 'separator' narrows from 'String' to 'Char'.
'Public Overloads Function Split(ParamArray separator As Char()) As String()': Argument matching parameter 'separator' narrows from 'String' to 'Char'.
'Public Overloads Function Split(separator As Char(), count As Integer) As String()': Argument matching parameter 'separator' narrows from 'String' to 'Char()'.
'Public Overloads Function Split(separator As Char(), count As Integer) As String()': Argument matching parameter 'count' narrows from 'String' to 'Integer'.
'Public Overloads Function Split(separator As Char(), options As StringSplitOptions) As String()': Argument matching parameter 'separator' narrows from 'String' to 'Char()'.
'Public Overloads Function Split(separator As Char(), options As StringSplitOptions) As String()': Argument matching parameter 'options' narrows from 'String' to 'StringSplitOptions'.
I've tried any number of different ways of implementing the Split, but nothing works.
I also tried:
Code:
Dim testString As String = "Look at these!"
'Returns an array containing "Look", "at", and "these!".
Dim testArray() As String = Split(testString)
again copied directly from a Visual Basic reference. It gives the error message:
Error BC30469 Reference to a non-shared member requires an object reference.
Again, the same statements work fine when run in another program.
FWIW, I have:
Imports System.Threading
Imports System.IO
Imports System.String
Is there a reference missing, or something corrupt?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|