Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic .NET (http://www.programmingforums.org/forum19.html)
-   -   return key (http://www.programmingforums.org/showthread.php?t=11128)

NightShade01 Aug 20th, 2006 10:31 PM

return key
 
Hey all quick question. I want to display all the file names of all the files within a directory. so i wrote a click_button function that does the following:
:

Dim sFile() As String = Directory.GetFiles("C:\test", "*.txt")
        Dim i As Integer
        For i = 0 To sFile.GetUpperBound(0)
            txtconsole.AppendText(sFile(0))

        Next


the problem is that it just displays my text in a text box one after the other. I want it to output the file name, go to the next line and then out the next file name. I can't seem to find how to get the cursor to "return" b4 outputting the next file name. Any ideas?

BlazingWolf Aug 20th, 2006 11:15 PM

txtconsole.AppendText(sFile(0) + "\r\n")

That should add a line break.

NightShade01 Aug 20th, 2006 11:18 PM

thanks i actually found another way too

:

Dim ret As String = ControlChars.NewLine
txtconsole.AppendText(sFile(i) & ret)


lectricpharaoh Aug 21st, 2006 4:59 AM

You can use VbCrLf, too; this is the carriage return/linefeed combination. There are some other predefined constants here that you might find interesting.

randum77 Aug 21st, 2006 12:08 PM

I use the " ControlChars.NewLine() " when doing a new line after text.

DaWei Aug 21st, 2006 1:22 PM

Sounds familiar. Did you happen to see post #3?


All times are GMT -5. The time now is 12:50 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC