Thank you for so easy to understand videos. I had difficulty understanding this topic but after watching this video , I understood the topic very well. Thank you.
honestly, i've been doing coding for about 6 years now, and text files were a sort of, no go topic for me, this honestly made it seem so simple I feel a little stupid xD But in all seriousness, thanks mate, this has helped a lot
tip for anyone who is watching this: if you are using windows, in file explorer make your text file, click on the "home tab" on top, and click copy path. You don't have to manually copy the path every time.
I have a question, at the ending you're adding jon doe to the list and then writing the list to the file. But the other names were already in there. I thought there have to be the names from before plus the names from before again plus jon doe. Why is this not the case? Does the content of the file getting overwritten with File.WriteAllLines?
Each time we run the program we do this (1) read all lines (2) add John Doe to the list of names (3) write the list back to the file. The file is overwritten each time. There is an option to the writeAllLines() method to either append or overwrite the file. Overwrite is the default choice if no parameter is provided. Check out the docs on the method here docs.microsoft.com/en-us/dotnet/api/system.io.file.writealllines?view=netframework-4.8
Nice video. How will you bind the data for an employee registration form on the each text box that is named accordingly? When I tried doing the data binding, all the datas are binded on a single text box?
Hello Shad, thanks for a well explained video! I have one question thought, when i try to run my program to read the text file it throws me an error of access denied. Any idea how can i fix that? Thanks in advance!
I hope this is helpful making something in c# where I want to store an id and a date on a file line. With c++ (my native programming language) I could just get a for loop to go over each line and directly copy the set amount of values within each line into different variables (separate for ID and date) within an array
Having an issue where filepath is denied access. I've tried it on multiple text files and still receive the same problem. The program reads the file just fine. It just doesn't write to it. Saw other people were experiencing the same thing was hoping for a quick fix. Using VS 2019 CE.
@@deathvaisen6381 I just created a new folder through VS2020E. That will allow you to read and write only to the folder that was created through the program. Basically, my CPU didn't acknowledge permissions so reading/editing/appending were confined to the program's own environment. Hope that helps!
I have a question. After I read the textfile, if I wanted to write the same thing in a different format, how could I do that? For example, now my textfile says 116 11/2/2012 18:22 N9 45.483 E10 30.495 416 m Now I want to write them to another file in the following manner 116, 11/2/2012 18:22, N9 45.483 E10 30.495, 416m How could I make it so that all the information are lined up in one line, and separate them with " , " ?
It could be that the file is named differently than what it appears. Check to see that file extensions are visible on your computer. The file may be called filename.txt.txt instead of filename.txt
Perhaps you need a toString() method defined in the class/object you are trying to display. Here is a good link to explain it ruclips.net/video/TYsiP_l5Ysg/видео.html
Perhaps the location of the file is not accessible by the user you are using on your computer. Try making whichever outlook account you are signed onto your computer as, admin. If this doesn't work, idk. If you're on mac, idk.
I don't really have a question I just want to say this was a great video
It is a great video
Thanks dude, this is exactly what I needed to learn for a lab question in my programming class at uni
Very useful video. I'm primarily a c++ user but you can't beat the ui building tools in c#.
Thank you for so easy to understand videos. I had difficulty understanding this topic but after watching this video , I understood the topic very well. Thank you.
honestly, i've been doing coding for about 6 years now, and text files were a sort of, no go topic for me, this honestly made it seem so simple I feel a little stupid xD
But in all seriousness, thanks mate, this has helped a lot
tip for anyone who is watching this: if you are using windows, in file explorer make your text file, click on the "home tab" on top, and click copy path. You don't have to manually copy the path every time.
Thank you. This was simple, helpful and using the list approach makes the class more versatile.
Thank you Prof Sluiter for precise explanation
Thank you so much Professor Sluiter
EXCELLENT !!! One of the best on just what I was looking for. 😊👍👌👍
Great tutorial! is it the same as using StreamReader/StreamWriter? Thanks!
You are the best, I am going to be a good C# programmer soon
Good to hear. How is your plan working out so far?
Do you have any tricky ways to save txt file as different names such as 123 while theere is already a txt file as that one thanks for your video
I have a question, at the ending you're adding jon doe to the list and then writing the list to the file. But the other names were already in there. I thought there have to be the names from before plus the names from before again plus jon doe. Why is this not the case? Does the content of the file getting overwritten with File.WriteAllLines?
Each time we run the program we do this (1) read all lines (2) add John Doe to the list of names (3) write the list back to the file. The file is overwritten each time. There is an option to the writeAllLines() method to either append or overwrite the file. Overwrite is the default choice if no parameter is provided. Check out the docs on the method here docs.microsoft.com/en-us/dotnet/api/system.io.file.writealllines?view=netframework-4.8
How to search for it. I have etc. John and he has number one after him and when i enter 1 to display john
Nice video. How will you bind the data for an employee registration form on the each text box that is named accordingly? When I tried doing the data binding, all the datas are binded on a single text box?
i do this, but wondering whats the pros and cons to stream reader vs this
I have a problem with the code :
My file name and path are correct but it says it can not find it
great video, I learned something new today
Glad you liked it!
saved me from a less than effective class cession
Keep up the good work
Great video sir thank you!!!
Hello Shad, thanks for a well explained video!
I have one question thought, when i try to run my program to read the text file it throws me an error of access denied. Any idea how can i fix that?
Thanks in advance!
Try running your application as adminstrator.
@@cossinle still get the same error. Any possible solutions i could try?
I fixed the problem. Thanks for the help!
@@magmyr why cant you say how you fixed it? there are ppl who have the same problem.
@@magmyr how
Hello, how can I return a specific line in all lines. Tnx
how do i delete words on the text instead of writing to it ?
I hope this is helpful making something in c# where I want to store an id and a date on a file line. With c++ (my native programming language) I could just get a for loop to go over each line and directly copy the set amount of values within each line into different variables (separate for ID and date) within an array
Super helpful. Thanks alot
Having an issue where filepath is denied access.
I've tried it on multiple text files and still receive the same problem.
The program reads the file just fine. It just doesn't write to it.
Saw other people were experiencing the same thing was hoping for a quick fix. Using VS 2019 CE.
I fixed it. While the problem is common, the solution is not so much.
Those who come across this problem, leave a reply and I'll share my fix.
@@calvinking3355 How to fix it man
@@deathvaisen6381 I just created a new folder through VS2020E. That will allow you to read and write only to the folder that was created through the program. Basically, my CPU didn't acknowledge permissions so reading/editing/appending were confined to the program's own environment.
Hope that helps!
I have a question. After I read the textfile, if I wanted to write the same thing in a different format, how could I do that?
For example, now my textfile says
116
11/2/2012 18:22
N9 45.483 E10 30.495
416 m
Now I want to write them to another file in the following manner
116, 11/2/2012 18:22, N9 45.483 E10 30.495, 416m
How could I make it so that all the information are lined up in one line, and separate them with " , " ?
You can join strings in C# very easily. Here is a good page to explain it docs.microsoft.com/en-us/dotnet/csharp/how-to/concatenate-multiple-strings
Thanks for info. :)
It's only showing FileNotFoundException . How should I resolve this exception ?
It could be that the file is named differently than what it appears. Check to see that file extensions are visible on your computer. The file may be called filename.txt.txt instead of filename.txt
@@shadsluiter Thank you , that was exactly what was happening.
Tanx for the information
It didn't show me my combos (my list) it just showed alot of system.string stuff can you help?
Perhaps you need a toString() method defined in the class/object you are trying to display. Here is a good link to explain it ruclips.net/video/TYsiP_l5Ysg/видео.html
Where's the next one? You mentioned "in a future video .." and then I can't find it..
ruclips.net/video/EY7IdBDl4PI/видео.html
How to read and write to EXE FILE?
Can you help me, i have this error, System.UnauthorizedAccessException,how should i fix this
staccoverflo
Perhaps the location of the file is not accessible by the user you are using on your computer. Try making whichever outlook account you are signed onto your computer as, admin. If this doesn't work, idk. If you're on mac, idk.
thanks bush
Good video thx
thank you
Good video thanks
So nice of you
shad sluiter your welcome dude
nice
Very helpfull
what does the @ before the string mean?
The @ character specifies a string as a verbatim literal string. In this way you can use characters like \ without escape characters.
@@pedro2mnunes that is actually very useful, thanks
:)
Thanks :D
Doesn't work :/
Great video, but on a completely unrelated note this guy looks so much like kronos from god of war
Maybe he is kronos
Thank you