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. Read file data when opening from...

Read file data when opening from...

Scheduled Pinned Locked Moved Visual Basic
tutorial
12 Posts 2 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.
  • T Taen_Karth

    I have developed a text editing software and I was wondering how to accomplish the following. I have set all .rtf files to open with my program by default in Windows I would like to know how to read the data from the .rtf file while my program opens Thanks, Taen Karth

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #2

    You'll need to read this: http://www.google.com.au/search?hl=en&q=rtf+file+format&meta=[^] and write some code that reads that format. Christian Graus - Microsoft MVP - C++

    T 1 Reply Last reply
    0
    • C Christian Graus

      You'll need to read this: http://www.google.com.au/search?hl=en&q=rtf+file+format&meta=[^] and write some code that reads that format. Christian Graus - Microsoft MVP - C++

      T Offline
      T Offline
      Taen_Karth
      wrote on last edited by
      #3

      I don't think I quite explained it well enough. I am using a RichtextBox control and VB.NET 2005. I can read a .rtf fle into the richtextbox control using one simple command (.loadfile). There has to be a more straight forward way to accomplish this. Thanks, Taen Karth

      C 1 Reply Last reply
      0
      • T Taen_Karth

        I don't think I quite explained it well enough. I am using a RichtextBox control and VB.NET 2005. I can read a .rtf fle into the richtextbox control using one simple command (.loadfile). There has to be a more straight forward way to accomplish this. Thanks, Taen Karth

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #4

        There's a single command which loads the RTF and you want something more simple ? I don't understand ? Christian Graus - Microsoft MVP - C++

        T 1 Reply Last reply
        0
        • C Christian Graus

          There's a single command which loads the RTF and you want something more simple ? I don't understand ? Christian Graus - Microsoft MVP - C++

          T Offline
          T Offline
          Taen_Karth
          wrote on last edited by
          #5

          Obviously... When the programs opens it needs to load the file that called it as the default app to open in... My questions is how do you capture the file that opened it. When windows sets a program as default editor for a file type...when that file type is clicked and it opens the program how does the program know what called it? Thanks, Taen Karth

          C 1 Reply Last reply
          0
          • T Taen_Karth

            Obviously... When the programs opens it needs to load the file that called it as the default app to open in... My questions is how do you capture the file that opened it. When windows sets a program as default editor for a file type...when that file type is clicked and it opens the program how does the program know what called it? Thanks, Taen Karth

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #6

            I'm not sure it does. Or do you mean how does it know what file was being passed to it ? I'd say the filename is passed as a parameter. Christian Graus - Microsoft MVP - C++

            T 1 Reply Last reply
            0
            • C Christian Graus

              I'm not sure it does. Or do you mean how does it know what file was being passed to it ? I'd say the filename is passed as a parameter. Christian Graus - Microsoft MVP - C++

              T Offline
              T Offline
              Taen_Karth
              wrote on last edited by
              #7

              Yeah that is exactly what I mean. How does it discern the parameter and file that was passed to it and how do you code using it. I assume that the parameter it passes is the file system path to the file...which would enable me to use the .loadfile element of the richtextbox control to load the data. Just not sure how to capture the parameter... Thanks, Taen Karth

              C 1 Reply Last reply
              0
              • T Taen_Karth

                Yeah that is exactly what I mean. How does it discern the parameter and file that was passed to it and how do you code using it. I assume that the parameter it passes is the file system path to the file...which would enable me to use the .loadfile element of the richtextbox control to load the data. Just not sure how to capture the parameter... Thanks, Taen Karth

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #8

                Ah, OK. I still can't get that from the wording of the original question :-) Your program entry point is a static void main method. That method is passed an array of arguments. You can check that array, the first argument passed in there is going to be the file path, so you can capture it there, and use it accordingly. Christian Graus - Microsoft MVP - C++

                T 1 Reply Last reply
                0
                • C Christian Graus

                  Ah, OK. I still can't get that from the wording of the original question :-) Your program entry point is a static void main method. That method is passed an array of arguments. You can check that array, the first argument passed in there is going to be the file path, so you can capture it there, and use it accordingly. Christian Graus - Microsoft MVP - C++

                  T Offline
                  T Offline
                  Taen_Karth
                  wrote on last edited by
                  #9

                  hehe...sorry for the confusion but I, for the life of me, could not understand the logic of what was supposed to be happening. Now I understand it in theory and I am still too green to understand completely what you are telling me above. I have no Static Void method in my project. If this is just an invisible method?:wtf: that is assumed, how do I capture it? Thanks, Taen Karth

                  C 1 Reply Last reply
                  0
                  • T Taen_Karth

                    hehe...sorry for the confusion but I, for the life of me, could not understand the logic of what was supposed to be happening. Now I understand it in theory and I am still too green to understand completely what you are telling me above. I have no Static Void method in my project. If this is just an invisible method?:wtf: that is assumed, how do I capture it? Thanks, Taen Karth

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #10

                    The syntax may be different for VB. Man, I hate VB. It seems this is another thing that VB does by 'magic', instead of via code. http://www.devx.com/vb2themax/Tip/18748[^] It looks like you have to add the code to make things work in a more 'normal' way, via a main method. Christian Graus - Microsoft MVP - C++

                    T 1 Reply Last reply
                    0
                    • C Christian Graus

                      The syntax may be different for VB. Man, I hate VB. It seems this is another thing that VB does by 'magic', instead of via code. http://www.devx.com/vb2themax/Tip/18748[^] It looks like you have to add the code to make things work in a more 'normal' way, via a main method. Christian Graus - Microsoft MVP - C++

                      T Offline
                      T Offline
                      Taen_Karth
                      wrote on last edited by
                      #11

                      AHA! That's the stuff! I remember reading that before now. Thanks for bearing with me...:doh: and have a nice week!:-D Thanks, Taen Karth

                      C 1 Reply Last reply
                      0
                      • T Taen_Karth

                        AHA! That's the stuff! I remember reading that before now. Thanks for bearing with me...:doh: and have a nice week!:-D Thanks, Taen Karth

                        C Offline
                        C Offline
                        Christian Graus
                        wrote on last edited by
                        #12

                        My pleasure - glad to help. Christian Graus - Microsoft MVP - C++

                        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