?
Solved

I Cant Understand This Error Value of type '1-dimensional array of String' cannot be converted to 'String'.

Posted on 2004-11-23
4
Medium Priority
?
328 Views
Last Modified: 2008-02-01
HI

I keep reciving this error

'Value of type '1-dimensional array of String' cannot be converted to 'String'.

On the follwing Code :
 Files = CStr(dirLocalp.GetFiles(CStr(MTdir)))

The Files and MTdir variables are both of string type

any comments ??
 
M.Osman
0
Comment
Question by:1DrPC1
  • 2
4 Comments
 
LVL 1

Author Comment

by:1DrPC1
ID: 12652761
I tried to ensure that the tow varibls are of string type by using Cstr( ) Function
0
 
LVL 5

Expert Comment

by:LindzK
ID: 12652938
GetFiles returns an array
CSTr expects a singular item, and returns a string

Before performing the CStr, you need to loop through all of the items that getfiles returns, and Cstr each one individually
0
 
LVL 19

Accepted Solution

by:
arif_eqbal earned 150 total points
ID: 12653022
Hope you understand the error
you are trying to store an Array of Strings in a String
use the following instead

Files = String.Join(" " ,dirLocalp.GetFiles(MTdir))

This will join all the array elements and form one single String and store in the variable Files

0
 
LVL 1

Author Comment

by:1DrPC1
ID: 12653159

I think this is help :)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question