Results 1 to 21 of 21

Thread: Reading a Text File in Visual Basic 6

  1. #1

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,899

    Reading a Text File in Visual Basic 6

    hello guys, it's me again.

    I am looking to have a text file to be read by doing a shell action, after the file has been made in text chars. I need it to look something like this:
    Code:
            With Main.CustomDialog1
                .Action = 1
                Main.Text1.Text = .Data
                .Filter = "zip"
            End With
    Can someone please help me with my coding problem of mine, thanks in advance also, even....

    PS: Please note that .Action = 1, is the loud open dialog box and then .Action = 2, is the quite file opening form class in my ActiveX control
    Last edited by ThEiMp; Jan 9th, 2021 at 05:51 AM.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  2. #2
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Reading a Text File in Visual Basic 6

    reading a text file is so basic Im not sure I understand if this is really what you need.
    and there should be hundreds of examples in the forum and if you google to read a text file. its not a problem you should ask for since its really documented and explained plenty!

  3. #3
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Reading a Text File in Visual Basic 6

    Quote Originally Posted by ThEiMp View Post
    I am looking to have a text file to be read by doing a shell action, after the file has been made in text chars
    What does this mean?
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  4. #4

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,899

    Re: Reading a Text File in Visual Basic 6

    -- This is what I have been working on for the graveyard and also the widow maker shifts, so then...
    Code:
            With Main.CustomDialog1
                .Data = Item1
                    Open .Path & "\" & .FileName & ".zip" For Input As #1
                        Do While Not EOF(1)
                            Item1 = Input(1, #1)
                        Loop
                    Close #1
            End With
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  5. #5

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,899

    Re: Reading a Text File in Visual Basic 6

    I am trying to run the file into notepad using the shell command
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  6. #6
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: Reading a Text File in Visual Basic 6

    you mean, you want to OPEN THE FILE USING NOTEPAD CALLED FROM VB6?
    Sam I am (as well as Confused at times).

  7. #7
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Reading a Text File in Visual Basic 6

    So, you have text files with .zip extensions?
    Normally a .zip file would be a compressed file, and you can't open a compressed file for Input in Visual Basic and read anything meaningful from it.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  8. #8

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,899

    Re: Reading a Text File in Visual Basic 6

    well actually I wrote a zip data file, that I made in WinRAR and then encrypted it using VB6. Then I need to either use Input or Binary to do this with, what I am looking here to do so, with it
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  9. #9

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,899

    Re: Reading a Text File in Visual Basic 6

    Quote Originally Posted by SamOscarBrown View Post
    you mean, you want to OPEN THE FILE USING NOTEPAD CALLED FROM VB6?
    Correct
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  10. #10

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,899

    Re: Reading a Text File in Visual Basic 6

    It now looks something like this source code, as below in the code tags...
    Code:
    Dim Item1 As String
    
        With Main.CustomDialog1
            Open .Path & "\" & .FileName For Binary As #1
                ReDim Item1(LOF(1) - 1)
                Get 1, 1, Item1
            Close #1
        End With
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  11. #11
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: Reading a Text File in Visual Basic 6

    What does that code have to do with opening a file using notepad? I'm confused (see my signature)....
    Sam I am (as well as Confused at times).

  12. #12

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,899

    Re: Reading a Text File in Visual Basic 6

    Quote Originally Posted by SamOscarBrown View Post
    What does that code have to do with opening a file using notepad? I'm confused (see my signature)....
    I need to prepare the department slot for the data to then be readable. because I have encrypted it, then needs to then be unencrypted, and then made to be shelled, in the IDE...

    Like this:
    Code:
    Rem This is the dimmed variable, that I wish to remove and use as a textbox to capture the information, to make the data text file, be done with...
    Dim Item1 As String
    
         Rem The constructing of the file goes here!!
        With Main.CustomDialog1
            Open .Path & "\" & .FileName For Binary As #1
                ReDim Item1(LOF(1) - 1)
                Get 1, 1, Item1
            Close #1
        End With
    
        Rem The execution of the file goes here!!
       With Main.CustomDialog1
            Shell .Path & "\" & .Filename, vbMaximisedFocus
       End With
    Can I get this done without a Dimmed Variable, as such then please help me out here, then. it's only one variable, I wish I could do without it and still achieve my best results. could I also use a textbox to contain the data inside of it, then???
    Last edited by ThEiMp; Jan 10th, 2021 at 04:51 AM.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  13. #13
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: Reading a Text File in Visual Basic 6

    1. What is wrong with using a variable?
    2. Does your code even work? Strangest way to open a file I have ever seen.
    3. Once you DO open your encrypted file, you must decrypt it. If it was a zip file, you obviously have to unzip it. I surely don't see any of that being done in that 'code' of yours. For an example of encrypting and decrypting a file, see this example...maybe THAT will help you: https://www.fortypoundhead.com/showc...sp?artid=24322
    Sam I am (as well as Confused at times).

  14. #14
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: Reading a Text File in Visual Basic 6

    An example (encryption - decryption) of one file into another.
    Code:
    Public Bt As Byte, Btn As Byte
    Public FileLong As Long
    FileLong = FileLen(FileName)
            Open .Path & "\" & .FileName For Binary As #1
      sFile = FreeFile
          For i = 1 To FileLong      
                Get #1, 1, Bt  'Read 1 byte
              Btn = Not (Bt)    'Byte inversion (Example of encryption and decryption)
                Put #sFile, i, Btn      '
              Next i   
            Close #1
        Close #sFile
    Can be decrypted into a variable
    Code:
    Dim Item1 As String
        Item1 = ""
            Open .Path & "\" & .FileName For Binary As #1
          For i = 1 To FileLong
                Get #1, 1, Bt
              Btn = Not (Bt)
                 Item1 = Item1 & Asc(Btn)
              Next i   
            Close #1

  15. #15
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Reading a Text File in Visual Basic 6

    ReDim on a string variable?

  16. #16
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: Reading a Text File in Visual Basic 6

    OP has no clue...I guess what needs to happen is OP needs to take it one step at a time:

    1-learn how to decrypt a file (Maybe learn how to unzip one first????)
    2-learn how to import a file
    3-learn how to save a file
    4-learn how to open a saved TEXT file with NotePad
    Sam I am (as well as Confused at times).

  17. #17
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Reading a Text File in Visual Basic 6

    Im very confused here,
    most of the time ThEiMp seems to be sure about what he do.
    but most of the time his examples are confusing and very oddly written.
    Im amazed he can make anything work.
    he forgets about FreeFile, he redim a string, he seems to want to "create" a file, but uses "Get".
    I recommend reading VB6 for beginners.
    https://www.freetutes.com/learn-vb6/

  18. #18

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,899

    Re: Reading a Text File in Visual Basic 6

    So sorry. I wish to open a file, using Get
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  19. #19
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Reading a Text File in Visual Basic 6

    the most common way, if u want to use GET is:

    Code:
    Dim FF%
    Dim Size&
    Dim Data() as Byte
    
    FF = FreeFile
    Open Filename For Binary Access Read As #FF
    Size = FileLen(Filename)
    ReDim Data(Size - 1)
    Get #FF, , Data
    Close #FF
    now, Data will have the entire file into byte.
    now u can convert to string, search or do whatever u want with that byte array.

  20. #20
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: Reading a Text File in Visual Basic 6

    You could attach a project (with appropriate comments in the code)

  21. #21

    Thread Starter
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,899

    Re: Reading a Text File in Visual Basic 6

    Here it is my source code with the project of mine, then so be it
    Attached Files Attached Files
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width