1 / 10

Opening and reading files

Opening and reading files. Name:. Why is it important to read and write files?. Evaluate the importance of it and describe when you would need it. Make a new project. 2 buttons – open and write 1 textbox – with multiline Efficient and extended: make sure they all have suitable names.

mabli
Download Presentation

Opening and reading files

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Opening and reading files Name:

  2. Why is it important to read and write files? • Evaluate the importance of it and describe when you would need it

  3. Make a new project • 2 buttons – open and write • 1 textbox – with multiline • Efficient and extended: make sure they all have suitable names

  4. Make a file in your my documents • Make a text file in your my documents called – test

  5. Add this code to write • Dim FILE_NAME As String = "C:\Users\Miles Conway\Documents\test2.txt" • Dim objWriter As New System.IO.StreamWriter(FILE_NAME) • objWriter.WriteLine(TextBox1.Text) • objWriter.Close() • MsgBox("Text written to file") • Extended: use the if statement to check if the file exists

  6. Add this code for read • Dim FILE_NAME As String = "C:\Users\Miles Conway\Documents\test2.txt“ • Dim objReader As New System.IO.StreamReader(FILE_NAME) • TextBox1.Text = objReader.ReadToEnd • objReader.Close() • Extended: use the if statement to check if the file exists

  7. Evaluation • What is the program doing so far? • How is your efficient is your programming?

  8. Task 1 • Make a program where you can add a new high score each time • You should be able to open text file • You should be able to write to the text file • Use IF statements and different text boxes

  9. Extended challenge: Task 2 • Make a program that has a list of films and the price of them • The program should let the user enter the quantity • The quantity is multiplied by the price of the film

  10. Evaluation of programming • How well did the programming go today? • How can you improve? • Evaluate the importance of reading and writing files

More Related