EDUCATION COLLABORATION
    
  Alias   Guest 
      Sketchr    Class Tracker    My Calendar    My Notes    My ToDo Lists
VB.NET FILE HANDLING - CONSOLE MODE
 
Getting Started
CHECK FILES EXIST
MULTI MODULES
Create A File
Read The Whole File
APPEND FILE
USING VARIABLES
Search File
FILES MENU
       GUEST      
     
   YOU ARE NOW WORKING ON : GETTING STARTED
 
INSTRUCTIONS  

 

Use the code below to get you started with VB.NET Text Files
We are using Visual Studio and creating multiple modules within one project.
 
Module GettingStarted
 
    Sub Main()
 
        ' Using TextFiles with VB.Net
 
        'File extensions - make sure you can see them
 
        ' REPOS folder - Find and bookmark
 
        ' You must always OPEN a file before you can use it
 
        ' 3 steps
 
        '1) Open the file or create it
        '2) write to file
        '3) Close the file
 
        '************************************************
 
        FileOpen(1, "GetStarted.txt", OpenMode.Output)
 
        'If this file exists then open it - if not then Create the File and NAME it
        'The number 1 is the ID of this file
        ' If you have another file open it cannot be ID 1
        'This will create a file in your 'DEBUG' folder
        'Note, if this file already exists - it wll delete it and make a new one!!
 
        'write to the file
        PrintLine(1, "I must know this code")
        PrintLine(1, "to get A*")
 
        'Close the file (before we open it)
        FileClose(1)
 
        'Run this code, what do you see?
        'Go and check your debug folder
 
        Console.ReadLine()
 
        'interprated languages, ie python
        'compiled languages, ie vb, java
 
    End Sub
 
End Module



CLAIM THIS BADGE

Create a new project in Visual Studio called 'VBFileHandling'
Create a new module called 'Getting Started'

Print 3 lines of data and run the module
Note - ensure you have selected the correct module to run under 
the VBFileHandling - properties 

The console window should be empty - so go to your debug folder and find the file you should have created - open it and it should have 3 lines that you typed

 

 




Terms of Service   Terms & Conditions   Privacy   Security   Safety   Contact Us  
quozr.org - DevXel © 2022  |  Online Now:  51