none
Reading from text files

    Question

  • Hi people,

    I have a form with a split container, panel 1 and panel 2!
    Panel 1 has multiple labels that are being used as buttons to (try) display text that i have in text files in the resource folder.

    I can and have managed to read and write to text files that are in local directories but can't manage to get the button/label to open and display resource text files into the correct panel.

    I am not bothering with reading lines, i just want it to get everything in the text file and display it as is!

    Does anyone know how i can do this? And can you help please?

    Thanks in advance


    regards Flatland France


    • Edited by EyeMan Android Saturday, July 23, 2016 6:53 AM forgot something
    Saturday, July 23, 2016 6:50 AM

Answers

  • If the text file was added to resources using Resources tab of Project Properties, then try this:

      TextBox1.Text = My.Resources.TextFile1

    Where TextFile1 is the name of resource and TextBox1 is the textbox added to panel 2.

    Apply some properties to text box, for example: Multiline —True, WordWrap — False, ScrollBars — Both.

    If it is actually a file on disk, then use File.ReadAllText.

    Otherwise, give details about your data.


    • Edited by Viorel_MVP Saturday, July 23, 2016 11:37 AM
    • Marked as answer by EyeMan Android Saturday, July 23, 2016 11:50 AM
    Saturday, July 23, 2016 11:36 AM

All replies

  • Is this the most difficult thing to do in VB? or just so easy that nobody can be bothered to help?

    regards Flatland France

    Saturday, July 23, 2016 10:40 AM
  • If the text file was added to resources using Resources tab of Project Properties, then try this:

      TextBox1.Text = My.Resources.TextFile1

    Where TextFile1 is the name of resource and TextBox1 is the textbox added to panel 2.

    Apply some properties to text box, for example: Multiline —True, WordWrap — False, ScrollBars — Both.

    If it is actually a file on disk, then use File.ReadAllText.

    Otherwise, give details about your data.


    • Edited by Viorel_MVP Saturday, July 23, 2016 11:37 AM
    • Marked as answer by EyeMan Android Saturday, July 23, 2016 11:50 AM
    Saturday, July 23, 2016 11:36 AM
  • Viorel_

    Thankyou so very much, i had tried everything and anything even your solution'ish but just couldn't get it to work.

    You are a diamond

    Cheers


    regards Flatland France

    Saturday, July 23, 2016 11:51 AM