Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. text files

text files

Scheduled Pinned Locked Moved Visual Basic
question
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    WartHog000
    wrote on last edited by
    #1

    display txt in a picture box? or another way OpenFileDialog1.Filter = "Textfiles (*.txt)|*.txt" If(OpenFileDialog1.ShowDialog()) = DialogResults.OK Then //i'm a attepting this wrong? Or can i use pictureBox?

    J 1 Reply Last reply
    0
    • W WartHog000

      display txt in a picture box? or another way OpenFileDialog1.Filter = "Textfiles (*.txt)|*.txt" If(OpenFileDialog1.ShowDialog()) = DialogResults.OK Then //i'm a attepting this wrong? Or can i use pictureBox?

      J Offline
      J Offline
      Jim Matthews
      wrote on last edited by
      #2

      i'm not sure exactly what you want to do... do you want to display a list of text files from a particular directory to the user? the optimal way to do this is think would be to use a list box and just query directly into the filesystem for a list of files (with a filter for text files). Then add the results into your listbox. am i mis-understanding you?


      -jim

      W 1 Reply Last reply
      0
      • J Jim Matthews

        i'm not sure exactly what you want to do... do you want to display a list of text files from a particular directory to the user? the optimal way to do this is think would be to use a list box and just query directly into the filesystem for a list of files (with a filter for text files). Then add the results into your listbox. am i mis-understanding you?


        -jim

        W Offline
        W Offline
        WartHog000
        wrote on last edited by
        #3

        hey jim, yes it was unclear what i was trying to say before...it is very simple def. for one who has been doing VB for a long time. I just want to view a Txt File in a picture box. To see what the txt file has written in it.. clearer?? hmmmmm......say if i had gg.txt on my desktop...now in my program i want to view that txt file, and what it says(its value). I Know how to view a imgage ,but not a txt file and a animation file(flash). *also do u know how to Run a flash animation in a VB form?* *i get lost with some programming terms, i am learning stuff on my own soo i am just gaining knowledge.*

        J T 2 Replies Last reply
        0
        • W WartHog000

          hey jim, yes it was unclear what i was trying to say before...it is very simple def. for one who has been doing VB for a long time. I just want to view a Txt File in a picture box. To see what the txt file has written in it.. clearer?? hmmmmm......say if i had gg.txt on my desktop...now in my program i want to view that txt file, and what it says(its value). I Know how to view a imgage ,but not a txt file and a animation file(flash). *also do u know how to Run a flash animation in a VB form?* *i get lost with some programming terms, i am learning stuff on my own soo i am just gaining knowledge.*

          J Offline
          J Offline
          Jim Matthews
          wrote on last edited by
          #4

          WartHog000 wrote: clearer?? much, thanks. typically you would use a textbox to display the contents of a text file. you use a filestream to get a handle for the actual file you want to open, then use a streamreader object to extract it's contents. something like below...

          Dim fileSelector As FileDialog
          If (fileSelector.ShowDialog = DialogResult.OK) Then
          Dim strmSelectedFile As New IO.FileStream(fileSelector.FileName, IO.FileMode.Open)
          Dim strmReadFile As New IO.StreamReader(strmSelectedFile)
          Me.txtFindItem.Text = strmReadFile.ReadToEnd
          End If

          of course you can set the filter and initialdirectory properties of the fileDialog in order to determine where to look and what to look for. WartHog000 wrote: also do u know how to Run a flash animation in a VB form? you would need some sort of a flash host control for development. i would think if you have flash installed (a developer version, not the flash player) there would be some sort of .net or com component for hosting flash files, but i'll let someone with more flash experience handle giving you advice on that... hope this helps.


          -jim

          W 1 Reply Last reply
          0
          • J Jim Matthews

            WartHog000 wrote: clearer?? much, thanks. typically you would use a textbox to display the contents of a text file. you use a filestream to get a handle for the actual file you want to open, then use a streamreader object to extract it's contents. something like below...

            Dim fileSelector As FileDialog
            If (fileSelector.ShowDialog = DialogResult.OK) Then
            Dim strmSelectedFile As New IO.FileStream(fileSelector.FileName, IO.FileMode.Open)
            Dim strmReadFile As New IO.StreamReader(strmSelectedFile)
            Me.txtFindItem.Text = strmReadFile.ReadToEnd
            End If

            of course you can set the filter and initialdirectory properties of the fileDialog in order to determine where to look and what to look for. WartHog000 wrote: also do u know how to Run a flash animation in a VB form? you would need some sort of a flash host control for development. i would think if you have flash installed (a developer version, not the flash player) there would be some sort of .net or com component for hosting flash files, but i'll let someone with more flash experience handle giving you advice on that... hope this helps.


            -jim

            W Offline
            W Offline
            WartHog000
            wrote on last edited by
            #5

            ahh ic....yes that will help alot. thanks a bunch.

            W 1 Reply Last reply
            0
            • W WartHog000

              ahh ic....yes that will help alot. thanks a bunch.

              W Offline
              W Offline
              WartHog000
              wrote on last edited by
              #6

              i did the code i got this error that the FileDialog did not work? the error has this: An unhandled exception is fileDialog a openFileDialog???

              W 1 Reply Last reply
              0
              • W WartHog000

                i did the code i got this error that the FileDialog did not work? the error has this: An unhandled exception is fileDialog a openFileDialog???

                W Offline
                W Offline
                WartHog000
                wrote on last edited by
                #7

                i figured it out.....thanks for all the help jim

                1 Reply Last reply
                0
                • W WartHog000

                  hey jim, yes it was unclear what i was trying to say before...it is very simple def. for one who has been doing VB for a long time. I just want to view a Txt File in a picture box. To see what the txt file has written in it.. clearer?? hmmmmm......say if i had gg.txt on my desktop...now in my program i want to view that txt file, and what it says(its value). I Know how to view a imgage ,but not a txt file and a animation file(flash). *also do u know how to Run a flash animation in a VB form?* *i get lost with some programming terms, i am learning stuff on my own soo i am just gaining knowledge.*

                  T Offline
                  T Offline
                  The Man from U N C L E
                  wrote on last edited by
                  #8

                  Why not read the text file into a string using a StreamReader and display the string in a multiline textbox. If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850)

                  W 1 Reply Last reply
                  0
                  • T The Man from U N C L E

                    Why not read the text file into a string using a StreamReader and display the string in a multiline textbox. If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850)

                    W Offline
                    W Offline
                    WartHog000
                    wrote on last edited by
                    #9

                    i get wat you are saying...multilined textbox?....is that a normal text box? or is it like a textbox that can view paragraphs from a .txt file?

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups