Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

[VB.NET] Folder Browser / Txt file?

I have 2 questions today :). My first question, is how can i make an advanced FolderBorwserDialog like this:

http://i138.photobucket.com/albums/q278/morrisdamo...

Second is, How can i open a .txt file in TextBox1.Text.

Short 'n' sweet.

3 Answers

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    I am writing the following code how to show .txt file information into textbox.

    1. OpenFileDialog1.CheckFileExists = True

    2. OpenFileDialog1.CheckPathExists = True

    3. OpenFileDialog1.DefaultExt = "txt"

    4. OpenFileDialog1.FileName = ""

    5. OpenFileDialog1.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"

    6. OpenFileDialog1.Multiselect = False

    7. If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

    8. TextBox1.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)

    9. End If

    Ok.

    and you can use the inbuilt dialogebox or else you can create your own from the form. you can create new form, and you can add each features as shown in the code.

    Bye

  • Anonymous
    1 decade ago

    Follow these steps:

    1) Add an OpenFileDialog to your form from the Toolbox

    2) Rename it to ofdMain

    3) Add this code where you want it to open the dialog (which will open the text file):

    If ofdMain.ShowDialog = Windows.Forms.DialogResult.OK Then

    TextBox1.Text = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)

    End If

    There you go, just three east steps

  • 1 decade ago

    m not really familiar with vb.net but ve used vb 0.6. for calling the advanced dialogbox, smething lyk: call commondiaolog: u got to use the call function.

    open a txt file in a textbox:a was never tot n so this how i do it,

    lemi know if uneed more vbhelp: ekuuri@yahoo.com

    dim d as string

    open ('"filename") for input as #1

    d,#1

    text1.text=d

    e.g

    open (c:\letter.txt) for input as #1

Still have questions? Get your answers by asking now.