VB.NET 2013 - Reading and Writing Text Files

  Рет қаралды 101,751

Nicholas Dingle

Nicholas Dingle

Күн бұрын

Пікірлер: 154
@petereells1246
@petereells1246 5 жыл бұрын
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.
@khadijanaheed8310
@khadijanaheed8310 6 жыл бұрын
VERY VERY USEFUL! UNDERSTOOD THE WHOLE FILEHANDLING!!!! MAY GOD BLESS YOU! AMEN!
@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.
@mpumelelomoyozw
@mpumelelomoyozw 4 жыл бұрын
this is the best tutorial i found here on file handling
@chrisraisin5587
@chrisraisin5587 4 жыл бұрын
You are a very good teacher, Nicholas. Well done.
@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 жыл бұрын
Sounds awesome, hope you go well in the exam.
@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!!
@fraserlangton8330
@fraserlangton8330 8 жыл бұрын
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
@muditasai6412
@muditasai6412 7 жыл бұрын
you know nothing.....
@DowzerWTP72
@DowzerWTP72 9 жыл бұрын
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 :)
@NicholasDingle
@NicholasDingle 9 жыл бұрын
DowzerWTP72 No worries, thanks for the comment
@pindiboii7247
@pindiboii7247 4 жыл бұрын
Same
@LuisCasanovaV
@LuisCasanovaV 10 жыл бұрын
Just what I needed! Thank for taking the time to record / share this tutorial!
@NicholasDingle
@NicholasDingle 10 жыл бұрын
Anytime!
@TheHelpGuy
@TheHelpGuy 5 жыл бұрын
Just found this today, saved my life buddy. Thank you very much
@codecoding753
@codecoding753 8 жыл бұрын
the best vb tutos on KZbin thanks
@colinhegarty1065
@colinhegarty1065 7 жыл бұрын
Hi, how do I get specific lines from the file?
@yathusanampikainathan8931
@yathusanampikainathan8931 5 жыл бұрын
For loop till the line you want, i guess?
@chamodthalayarathna4326
@chamodthalayarathna4326 3 жыл бұрын
Nice work. Very effective for my academics. Thank u.. keep doing like this.
@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.
@ForeclosureGhost
@ForeclosureGhost 3 жыл бұрын
Great video. Do you by chance have any videos about populating listviews from external text files in VB?
@dasireddyrohitreddy3618
@dasireddyrohitreddy3618 4 жыл бұрын
u have saved my life for the a level exam
@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
@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?
@rajtechking
@rajtechking 4 жыл бұрын
Really Great Video. You earned yourself a subscriber.
@fr4nkie82
@fr4nkie82 9 жыл бұрын
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
@NicholasDingle
@NicholasDingle 9 жыл бұрын
Sure thing, send away
@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
@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?
@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.
@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.
@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.
@ImSyed109
@ImSyed109 7 жыл бұрын
is it necessary to add ToUpper with input? what does it do?
@NicholasDingle
@NicholasDingle 7 жыл бұрын
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
@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
@thwbn3993
@thwbn3993 6 жыл бұрын
thank God I found your channel, dude!!!
@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
@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?
@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"
@ruchikarathi3840
@ruchikarathi3840 6 жыл бұрын
In the same way can we read excel files or csv files
@eplays9419
@eplays9419 9 жыл бұрын
How would I add text to a specific line, without deleting whats on line 2
@shitbanana758
@shitbanana758 9 жыл бұрын
ePlays yes how :C
@vincedelima7515
@vincedelima7515 9 жыл бұрын
+ePlays Openmode.append
@dragonboyjazz
@dragonboyjazz 7 жыл бұрын
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
@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
@nicholastrivella7966
@nicholastrivella7966 8 жыл бұрын
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 жыл бұрын
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
@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?
@londonnoods2765
@londonnoods2765 6 жыл бұрын
After 1 Hour I found You Lol.
@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
@shaniasooranna7351
@shaniasooranna7351 9 жыл бұрын
I've followed all the steps in your video :/ and there's no hello.txt which has been created
@heavenmashingaidze6488
@heavenmashingaidze6488 4 жыл бұрын
can you please show me how to connect access database to a console app in vb.net please please
@tomsvn7258
@tomsvn7258 3 жыл бұрын
Thank you.. it help me so much .. thanks again
@adnanshah3421
@adnanshah3421 8 жыл бұрын
you are awesome , i never understood vb from my teachers but you :* . thanks for it . how do we close file to save it ?
@NicholasDingle
@NicholasDingle 8 жыл бұрын
+Adnan Shah Glad I could help
@diyencurpen2424
@diyencurpen2424 4 жыл бұрын
what does .toUpper does
@hassansaqib13
@hassansaqib13 5 жыл бұрын
Thank you so much Sir!! Your video has been extremely helpful!! and yes..MOOOOOOOOOOOOOOO!!! coz why not!
@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 жыл бұрын
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?
@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.
@Duarte1298
@Duarte1298 4 жыл бұрын
Part 2: 16:12 :) you're welcome
@elvisndobe3063
@elvisndobe3063 6 жыл бұрын
thank you, good and easy to understand
@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)
@Fbs1969
@Fbs1969 Жыл бұрын
Thank you so much
@iwatchtechtutorials5236
@iwatchtechtutorials5236 9 жыл бұрын
Thank you very much!
@vincedelima7515
@vincedelima7515 9 жыл бұрын
nice tut
@minsoobae6458
@minsoobae6458 4 жыл бұрын
Console.WriteLine("ALL HAIL NICHOLAS DINGLE!! OUR SAVIOUR!!")
@KHALIDMEHMOOD-ww5xl
@KHALIDMEHMOOD-ww5xl 8 жыл бұрын
excellent
@hackerpro6742
@hackerpro6742 5 жыл бұрын
thanks bro
@stefanadrian5678
@stefanadrian5678 9 жыл бұрын
Ty a lot !
@seyhakhiev1496
@seyhakhiev1496 6 жыл бұрын
thank
@qaisarnawaz7236
@qaisarnawaz7236 5 жыл бұрын
Dude, you're funny :)
@cbzmemes5297
@cbzmemes5297 4 жыл бұрын
Numba
@louismilan4612
@louismilan4612 7 жыл бұрын
love this video. please marry me
@MSMVoid
@MSMVoid 3 жыл бұрын
Sorry but didn’t find this helpful
@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
VB.NET 2013: Parameters - ByRef vs ByVal, Optional and Arrays
19:52
Nicholas Dingle
Рет қаралды 17 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
VB.NET 2013 - Subs, Functions and Parameters
40:42
Nicholas Dingle
Рет қаралды 49 М.
VB.NET 2013: Classes - Methods, Members and Constructors
20:24
Nicholas Dingle
Рет қаралды 47 М.
VB.NET 2013 - Arrays
32:11
Nicholas Dingle
Рет қаралды 70 М.
VB.NET 2013 - Console Commands
19:36
Nicholas Dingle
Рет қаралды 70 М.
VB.NET 2013 - Lists
12:22
Nicholas Dingle
Рет қаралды 16 М.
VB.NET 2013 - Variables and operators
33:55
Nicholas Dingle
Рет қаралды 31 М.
VB.NET 2013 - Decisions
33:14
Nicholas Dingle
Рет қаралды 14 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН