|
-
Aug 2nd, 2002, 10:56 AM
#1
Thread Starter
yay gay
Option Strict On
i put option strict on to check it out but i having some problems like this one:
VB Code:
Files = FSO.GetFiles(ListView2.Items.Item(y).SubItems(1).Text & ListView2.Items.Item(y).SubItems(0).Text, TextBox2.Text)
he is saying this:
C:\Documents and Settings\JBRANCO\My Documents\Visual Studio Projects\thumber\Form1.vb(439): Option Strict On disallows implicit conversions from 'System.Array' to '1-dimensional array of String'.
what do i do to convert it?
also is option strict a good thing?
-
Aug 2nd, 2002, 11:22 AM
#2
Not sure but try this:
VB Code:
Files = CType(FSO.GetFiles(ListView2.Items.Item(y).SubItems(1).Text & ListView2.Items.Item(y).SubItems(0).Text, TextBox2.Text),String)
-
Aug 2nd, 2002, 11:46 AM
#3
Thread Starter
yay gay
i am still getting error with that
-
Aug 2nd, 2002, 12:13 PM
#4
What is Files declared as?
dim Files as array
-
Aug 2nd, 2002, 12:20 PM
#5
Frenzied Member
The problem might be with Files. What is it declared as?
Also FSO.GetFiles is returning an array.
Post more of the code.
BTW leave on option strict. It forces you to explictly conversion and so forth.
-
Aug 2nd, 2002, 01:04 PM
#6
Thread Starter
yay gay
-
Aug 5th, 2002, 08:18 AM
#7
Member
Sorry, the computer I'm on doesn't have VS.NET so I can't test this, but I think this is what is going on...
The " 'System.Array' to '1-dimensional array of String' " means that you are trying to do the following:
Dim array as System.Array
Dim stringArray() as String
'The following line will cause an Exception
array = stringArray
If FSO.GetFiles returns an array of Strings, then Files must be declaired by using the following:
Dim Files() as String
If needed, you can use the following technique to convert an array of one type to an array of another type:
Dim array as System.Array
Dim stringArray() as String
'ADD CODE TO FILL array HERE...
'The Array that you copy to must be able to hold the data
Redim stringArray(array.GetUpperBound(0))
'Use Array.Copy to convert array to stringArray
System.Array.Copy(array, stringArray, stringArray.Length)
Hope this helps.
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
|