Putting Array data in a string then showing it in a label.
-
I have an array...
private void Page\_Load(object sender, System.EventArgs e) { string \[\] dirs = Directory.GetDirectories(@"c:\\inetpub\\wwwroot\\shares\\folder\\", "b\*"); labelPath.Text=dirs.ToString(); }
as you can see it's value is assigned to the string "dirs" now I want it to show up thought he label "labelPath", but when I compile the page it shows "
System.String[]"
.... I need it to show the names of folders that start with "b", I can make it work as a consle application, but not a aspx page... can somebody please help...??? /\ |_ E X E GG -
I have an array...
private void Page\_Load(object sender, System.EventArgs e) { string \[\] dirs = Directory.GetDirectories(@"c:\\inetpub\\wwwroot\\shares\\folder\\", "b\*"); labelPath.Text=dirs.ToString(); }
as you can see it's value is assigned to the string "dirs" now I want it to show up thought he label "labelPath", but when I compile the page it shows "
System.String[]"
.... I need it to show the names of folders that start with "b", I can make it work as a consle application, but not a aspx page... can somebody please help...??? /\ |_ E X E GGLook at
String.Join()
leppie::AllocCPArticle(Generic DFA State Machine for .NET); -
Look at
String.Join()
leppie::AllocCPArticle(Generic DFA State Machine for .NET); -
string [] dirs = Directory.GetDirectories(@"c:\inetpub\wwwroot\shares\folder\", "b*");
I tried the Join Method but I can't get it to turn the above array "dirs" into a regular string that I can show though a label.... :-Ocan you show me? /\ |_ E X E GG
Try delimiting the strings with "<BR>". leppie::AllocCPArticle(Generic DFA State Machine for .NET);
-
Try delimiting the strings with "<BR>". leppie::AllocCPArticle(Generic DFA State Machine for .NET);
-
try
Console.WriteLine(String.Join('\n', dirs));
ORACLE One Real A$#h%le Called Lary Ellison
-
try
Console.WriteLine(String.Join('\n', dirs));
ORACLE One Real A$#h%le Called Lary Ellison
foreach(string x in Dirs) { labelPath.Text = labelPath.Text + x + "\n"; } \\the "\n" is for newline! if you want a new line! Leon v Wyk