VB.NET 2013 - Reading and Writing Text Files

Поделиться
HTML-код
  • Опубликовано: 10 дек 2024

Комментарии • 154

  • @petereells1246
    @petereells1246 5 лет назад +2

    Love this guy. Very simple - no BS - just code. I’ve been programming for 41 years and this is exactly what I need to get on my feet. I’ll bust programs into subroutines and design systems based upon my experience. UDEMY courses are good - but they teach you what they want you to know - not what you need to know. Thank you man. Love the Aussies.

  • @billylutcher6945
    @billylutcher6945 4 года назад

    Thank you so much. I starting to code in 2019. I lean qvery fast. Right now I'm making a game in Visual Basic. Without your video I would have given up on my game. Thank you so much and you are GOD.

  • @khadijanaheed8310
    @khadijanaheed8310 6 лет назад +11

    VERY VERY USEFUL! UNDERSTOOD THE WHOLE FILEHANDLING!!!!
    MAY GOD BLESS YOU! AMEN!

  • @finalflash98
    @finalflash98 8 лет назад

    THANK YOU SO MUCH SIR NICHOLAS DINGLE, I always thought filing was hard until I watched this video and managed to solve 3 to 4 tasks in my pre release exam paper for computer science 9608 ( keep up the good work!!!!!)

    • @NicholasDingle
      @NicholasDingle  8 лет назад +1

      Sounds awesome, hope you go well in the exam.

  • @mpumelelomoyozw
    @mpumelelomoyozw 4 года назад

    this is the best tutorial i found here on file handling

  • @fraserlangton8330
    @fraserlangton8330 8 лет назад +3

    mate you're a fucking legend, I didn't have a fucking shit stain of an idea what append did but you are my shining light in the darkness, you showed me the way. I will build temples for you and we will worship you for years to come.
    The night is dark and full of terrrors

  • @chrisraisin5587
    @chrisraisin5587 4 года назад

    You are a very good teacher, Nicholas. Well done.

  • @DowzerWTP72
    @DowzerWTP72 9 лет назад +6

    Just *subscribed*. I've been looking for help like this for my AS levels, and your videos are perfect for what I am making! Thanks *so* much :)

  • @dennispeebles8910
    @dennispeebles8910 2 года назад

    excellent demonstrations, I was having trouble trying to read/write some files to use and reuse in my programs for various subs/functions. thanks!!

  • @LuisCasanovaV
    @LuisCasanovaV 10 лет назад +2

    Just what I needed! Thank for taking the time to record / share this tutorial!

  • @codecoding753
    @codecoding753 8 лет назад +5

    the best vb tutos on RUclips thanks

  • @TheHelpGuy
    @TheHelpGuy 5 лет назад

    Just found this today, saved my life buddy. Thank you very much

  • @HeshamALAhdal
    @HeshamALAhdal 9 лет назад

    Man i have to say thank you so so so much for this amazing tutorial, it is very understandable and you have amazing way to teach, good job and i wish you best .

    • @NicholasDingle
      @NicholasDingle  9 лет назад

      +Hesham AL-Ahdal (L.R.G) No worries, thanks mate!

  • @PatMcDonald41
    @PatMcDonald41 6 лет назад

    These tutorials are exceptional. Thank you.

  • @chamodthalayarathna4326
    @chamodthalayarathna4326 3 года назад

    Nice work. Very effective for my academics. Thank u.. keep doing like this.

  • @colinhegarty1065
    @colinhegarty1065 7 лет назад +8

    Hi, how do I get specific lines from the file?

  • @dasireddyrohitreddy3618
    @dasireddyrohitreddy3618 4 года назад

    u have saved my life for the a level exam

  • @thwbn3993
    @thwbn3993 6 лет назад

    thank God I found your channel, dude!!!

  • @urownplaylist
    @urownplaylist 5 лет назад

    Hi Nicholas, I have written program to create text file in the native folder in which my application installs(eg. c:/). I successfully generated setup file and i am able to install it but when i run it, it popups with "access to the is denied" message

  • @rajtechking
    @rajtechking 4 года назад

    Really Great Video. You earned yourself a subscriber.

  • @tonychen3316
    @tonychen3316 6 лет назад

    I have a stupid question, since I was a beginner, why the syntax in visual basic "Not equals to" is same as "equals to in the video?

  • @ForeclosureGhost
    @ForeclosureGhost 3 года назад

    Great video. Do you by chance have any videos about populating listviews from external text files in VB?

  • @KS-xw3wj
    @KS-xw3wj 8 лет назад

    If i want to pass an object variable to a text file, but not delete the previous entries how would i do it.
    It is for a little log. so ill pass a date/log number from 0 to 600 and time

    • @NicholasDingle
      @NicholasDingle  8 лет назад

      What you're looking for is Append. Append works like Output, but doesn't delete the file's original contents.

    • @KS-xw3wj
      @KS-xw3wj 8 лет назад

      +Nicholas Dingle Thanks

  • @londonnoods2765
    @londonnoods2765 6 лет назад +8

    After 1 Hour I found You Lol.

  • @izaansaquib6465
    @izaansaquib6465 7 лет назад

    why did u not simply write If input.ToUpper = ''STOP'' Then PrintLine(1, input) at 14:07 instead of ''STOP'' ps iam new at programing

  • @TheOriginalNEG2013
    @TheOriginalNEG2013 8 лет назад

    How can I look for a specific part of a file and cut it and a few character after it out.

    • @NicholasDingle
      @NicholasDingle  8 лет назад

      Do you know the line number? If so, read that many lines and then use the SubString function.

  • @danieloyewole8526
    @danieloyewole8526 7 лет назад

    When using form and textboxes how would i get it that the username and password are stored on the same line but separated with a comma

    • @NicholasDingle
      @NicholasDingle  7 лет назад

      Read the text into a string and then check out the split function - www.dotnetperls.com/split-vbnet

  • @nicholastrivella7966
    @nicholastrivella7966 8 лет назад +3

    Awsome tutorial. I have been struggling to find any vb console tutorials on how to import information from a CSV file into a 2D array. would you mind making one?

    • @NicholasDingle
      @NicholasDingle  8 лет назад +1

      That's a great idea, I'll add it to my video ideas.

    • @georgegallimore6690
      @georgegallimore6690 8 лет назад

      hey friend! remember me?

    • @NicholasDingle
      @NicholasDingle  8 лет назад

      +george gallimore sure do

    • @georgegallimore6690
      @georgegallimore6690 8 лет назад

      great! it's simple favor, i would like for you to edit. i have this screen capture code which i am trying to get it to save the screenshots with the same file name without over writing the other, egs screenshot1, screenshot2, screenshot3 all in the same folder with the same filename but count with 1 at the end.
      here is the code:
      If Not Directory.Exists(ScShot & "\ScreenCapture") Then
      Directory.CreateDirectory(ScShot & "\ScreenCapture")
      End If
      If Directory.Exists(ScShot & "\ScreenCapture") Then
      Try
      Dim screenshot1 As Bitmap
      Dim graph1 As Graphics
      screenshot1 = New Bitmap(Screen.PrimaryScreen.Bounds.Size.Width, Screen.PrimaryScreen.Bounds.Size.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
      graph1 = Graphics.FromImage(screenshot1)
      graph1.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy)
      Dim path As String = ("C:\Users\" & Convert.ToString(Guid.NewGuid()) & "\Documents\ScreenCapture\Screenshot" & ".png")
      screenshot1.Save("C:\Users\" & SystemInformation.UserName & "\Documents\ScreenCapture\Screenshot" & ".png", System.Drawing.Imaging.ImageFormat.Png)
      'Timer2.Start()
      Timer1.Stop()
      Catch error_q As Exception
      MsgBox(error_q.ToString)
      End Try
      End If

    • @NicholasDingle
      @NicholasDingle  8 лет назад

      That's not too bad, just use a while loop with a counter. Check if the file exists, if it does move to the next number and check again. Also note below I use SpecialDirectories to get the My Documents folder.
      Dim fileCounter As Integer = 1
      While IO.File.Exists(My.Computer.FileSystem.SpecialDirectories.MyDocuments &
      "\ScreenCapture\Screenshot" & fileCounter & ".png")
      fileCounter += 1
      End While

  • @ruchikarathi3840
    @ruchikarathi3840 6 лет назад

    In the same way can we read excel files or csv files

  • @Duarte1298
    @Duarte1298 4 года назад +1

    Part 2: 16:12 :) you're welcome

  • @bymunako
    @bymunako 7 лет назад

    Hi Nicholas, may I please ask how I would go about loading data from a text file that has delimiters. All the information online is really complicated and I can't quite understand it! I have saved an array into a text file, separating the contents with commas and what to load it again to be displayed in VB. Thank you!

    • @NicholasDingle
      @NicholasDingle  7 лет назад

      I won't be able to write the code, but you'll be using LineInput() to get it line by line and then use .Split() on your strings to cut it up by commas.
      Give those functions a Google and you can find out.

  • @dragonboyjazz
    @dragonboyjazz 7 лет назад +1

    hahaha poo folder FTW, thanks for the tutorial, keep making vids, even if just updates of old tutorials showing new ways to do them, because its real bloody hard to find any good ones

  • @examinestudios2410
    @examinestudios2410 8 лет назад

    Could we use a try and catch error handling with finding if there is a file or not?

    • @NicholasDingle
      @NicholasDingle  8 лет назад

      +Examine Studios You can but it might just be easier to use the IO.File.Exists. Since the try and catch will find all errors

    • @georgegallimore6690
      @georgegallimore6690 8 лет назад

      +Nicholas Dingle did you get access to the link? also i need your help with this code.
      can you give me a function able code to run a bat file from the resource in vb.net using the special directory methods? i added a bat file to my app resource and using a lot of methods to call it but it's not working, what i am trying is to do is to program my app to start a .bat file in it's resource with special directory method so that the app can be able to run an any pc without have to search the c drive a path with the bat file location, the app is a keygen.

  • @tomsvn7258
    @tomsvn7258 3 года назад

    Thank you.. it help me so much .. thanks again

  • @akhilteja9930
    @akhilteja9930 6 лет назад

    how the file properties were given?
    I am getting an error :-
    Error 1The name 'FileOpen' does not exist in the current context
    Error 2 The name 'FileOpen' does not exist in the current context

  • @shaniasooranna7351
    @shaniasooranna7351 9 лет назад

    I've created the ''hello.txt'' but i cannot find it on my computer .Why ?

    • @NicholasDingle
      @NicholasDingle  9 лет назад

      +Shania Sooranna If you created the file in VB.NET with just the filename "hello.txt" then it should be inside your Debug folder, which you'll find "Project Folder\bin\Debug"

  • @luigi8936
    @luigi8936 5 лет назад

    Hi NIck, that's a very interesting tutorial, it's really very helpful to me, but please i need to know how do i read only a specific number of items (say 120 items) from CSV file that has almost 800 items? Regards

  • @fr4nkie82
    @fr4nkie82 9 лет назад +1

    Hey, would it be possible to email you something that i am trying to make with vb? its been awhile since i used it and i do need some help

  • @eplays9419
    @eplays9419 9 лет назад

    How would I add text to a specific line, without deleting whats on line 2

  • @adnanshah3421
    @adnanshah3421 8 лет назад +3

    you are awesome , i never understood vb from my teachers but you :* . thanks for it . how do we close file to save it ?

  • @Matthew.1994
    @Matthew.1994 7 лет назад

    i ahve a textbox where i write in a word. Lets say a write Hello in it.
    When i press the button i want the programm to check if the word hello
    is in the textfile. I have multiple words in the textfile. i ahve
    "hello" "bye" and "one" in it. How can i let the programm search for a
    match? btw the textfile is on dropbox

    • @NicholasDingle
      @NicholasDingle  7 лет назад

      This is a massive question really. You can use a function called IO.File.ReadAllLines("myfile.txt") which will pull all lines from a text file into a Array of Strings. You can then loop through the array and check if the words you need are in it. If you mean that you want to download the file from Dropbox prior to opening it you need to look at WebClient.DownloadFile("myfile.txt")

    • @ruzivogwata3575
      @ruzivogwata3575 6 лет назад

      Array, do a linear search. Hopefully it works

  • @heavenmashingaidze6488
    @heavenmashingaidze6488 4 года назад

    can you please show me how to connect access database to a console app in vb.net please please

  • @ImSyed109
    @ImSyed109 7 лет назад

    is it necessary to add ToUpper with input? what does it do?

    • @NicholasDingle
      @NicholasDingle  7 лет назад +1

      I'll admit it's been a long while since I made this video and I forget where I used the ToUpper function. But ToUpper is good to convert characters in a string into all uppercase letters. Then it's easy to compare strings using if statements.

    • @ImSyed109
      @ImSyed109 7 лет назад

      Nicholas Dingle ok great thanks

  • @dongenfrank1990
    @dongenfrank1990 8 лет назад

    Thanks for the tutorial!
    I do have a small question... Which option do I have to select in the program to also get this 'suggestion/explanation message boxes' you get at for example 4.57

    • @NicholasDingle
      @NicholasDingle  8 лет назад

      When the parameter suggestion box comes up you can press the up and down arrow on the keyboard to see the options.

    • @dongenfrank1990
      @dongenfrank1990 8 лет назад

      Thank you for your reply, but it is actually this parameter suggestion box that I am curious about. when I write code is doesn't 'come up'.
      Do you know whether this is something you can turn on and off?

    • @NicholasDingle
      @NicholasDingle  8 лет назад

      +Frank van Dongen is this the problem? omegacoder.com/?p=1008

    • @dongenfrank1990
      @dongenfrank1990 8 лет назад

      Yes I think you're right. Maybe I've got a 'limited license' or something because I can't choose the first 4 options in Edit/Intellisense

    • @NicholasDingle
      @NicholasDingle  8 лет назад

      +Frank van Dongen odd. Have you got the community version? Also what version number are you running?

  • @shaniasooranna7351
    @shaniasooranna7351 9 лет назад

    I've followed all the steps in your video :/ and there's no hello.txt which has been created

  • @georgegallimore6690
    @georgegallimore6690 8 лет назад

    hey nicholas, i have a two solution project. in solution two, i have classes and module that i want to used in solution one
    but the two project is not linking. when i am in solution two all the class and modules show up in the toolbox but in solution one it's not. what do you think i am missing out?

    • @NicholasDingle
      @NicholasDingle  8 лет назад

      I'll assume you have two projects in one solution and that project two contains code for project one. You need to open My Project for project one and go to references. Add project two in there. After that down the bottom, tick the name of project two and you're good to go

    • @georgegallimore6690
      @georgegallimore6690 8 лет назад

      here is the project mega.nz/#!1gdDAbob

    • @NicholasDingle
      @NicholasDingle  8 лет назад

      Link says I need a decryption key

    • @georgegallimore6690
      @georgegallimore6690 8 лет назад

      +Nicholas Dingle here's my new link:
      drive.google.com/open?id=0B-K3TTJgHgWXbmxSbEVDYk1FUGc
      just right click and download the NHunspell project

    • @georgegallimore6690
      @georgegallimore6690 8 лет назад

      hey friend, did get the project?

  • @khairi_salleh466
    @khairi_salleh466 10 лет назад

    hello nicholas.my name is khairi and im from malaysia. i would like to ask you on how to make a vb program. there are 1000line of data in notepad. then user want to devide the 1000 line into whatever number their like using vb
    hope u can help me

    • @NicholasDingle
      @NicholasDingle  10 лет назад

      Hi mate do you want to email me your idea with a bit more detail? I'd love to help out, right now I'm not quite sure what you would like to do.

    • @khairi_salleh466
      @khairi_salleh466 10 лет назад

      hi mate. I already pm you at hangout
      do still using hangout?

    • @NicholasDingle
      @NicholasDingle  10 лет назад

      Khairi Salleh Not really. Do you want to email me an example text file you might be using in your application?

  • @Brewermb
    @Brewermb 5 лет назад

    I think VB.Net closes open files when you end the program, if you had left it running you would have got an error.

  • @diyencurpen2424
    @diyencurpen2424 4 года назад

    what does .toUpper does

  • @elvisndobe3063
    @elvisndobe3063 6 лет назад

    thank you, good and easy to understand

  • @hassansaqib13
    @hassansaqib13 5 лет назад

    Thank you so much Sir!! Your video has been extremely helpful!!
    and yes..MOOOOOOOOOOOOOOO!!! coz why not!

  • @Fbs1969
    @Fbs1969 Год назад

    Thank you so much

  • @wasifnaeem6672
    @wasifnaeem6672 8 лет назад

    Hello there Sir, I was wondering if you could help me out with accessing the binary files in random mode, i already know the method to access the file using Stream method but i am not able to do it by FileOpen method.. BTW.. You Rock..

    • @NicholasDingle
      @NicholasDingle  8 лет назад +1

      You can't actually use FileOpen and Stream at the same time. They are different generations of technology. I'm almost certain that under the hood, FileOpen would be using Streams.
      Depending on what you want to do I would go down the Stream method or using the File.ReadAllText methods. Hope I helped you there.

    • @wasifnaeem6672
      @wasifnaeem6672 8 лет назад

      Thanks for your quick reply.. I just want to put data into file and use Hash function to calculate the record starting position.. and read from the same position..e.g
      file.position = hash(thisfile.name)
      i amm not familier with ReadAllText method.. can you suggest any good book for console programming?

  • @iwatchtechtutorials5236
    @iwatchtechtutorials5236 9 лет назад

    Thank you very much!

  • @jennamurdhen9818
    @jennamurdhen9818 9 лет назад

    thank you for this interesting tutorial...:)

  • @bishallamichhane811
    @bishallamichhane811 7 лет назад

    hey there. Love your videos and thanks a lot.Can you make a video for random files? That would be so good of you.

    • @NicholasDingle
      @NicholasDingle  7 лет назад

      I might end up doing this for C# but VB won't really get much attention from me in the future.

    • @bishallamichhane811
      @bishallamichhane811 7 лет назад

      thank you for your response..

  • @AtomicNotes
    @AtomicNotes 3 года назад

    Great video but Windows defender is SO stupid and it blocked my program from creating the file :(

  • @AtomicNotes
    @AtomicNotes 3 года назад

    I called my extension a ds file (for my programming language DylanScript :D)

  • @KHALIDMEHMOOD-ww5xl
    @KHALIDMEHMOOD-ww5xl 8 лет назад

    excellent

  • @stefanadrian5678
    @stefanadrian5678 9 лет назад

    Ty a lot !

  • @vincedelima7515
    @vincedelima7515 9 лет назад

    nice tut

  • @hackerpro6742
    @hackerpro6742 5 лет назад

    thanks bro

  • @minsoobae6458
    @minsoobae6458 4 года назад

    Console.WriteLine("ALL HAIL NICHOLAS DINGLE!! OUR SAVIOUR!!")

  • @qaisarnawaz7236
    @qaisarnawaz7236 5 лет назад

    Dude, you're funny :)

  • @seyhakhiev1496
    @seyhakhiev1496 6 лет назад

    thank

  • @cbzmemes5297
    @cbzmemes5297 4 года назад

    Numba

  • @MSMVoid
    @MSMVoid 3 года назад

    Sorry but didn’t find this helpful

  • @louismilan4612
    @louismilan4612 7 лет назад

    love this video. please marry me

  • @luigi8936
    @luigi8936 5 лет назад

    Hi NIck, that's a very interesting tutorial, it's really very helpful to me, but please i need to know how do i read only a specific number of items (say 120 items) from CSV file that has almost 800 items? Regards