![]() The loop stops when the last Input statement encounters the end of the file. It can open and parse the lines of a given CSV file. When Visual Basic encounters the Loop statement, it returns program control to the “Do” statement a few lines earlier and tests for the end-of-file condition. This class can be used to parse and display data from a CSV file. Note that the line immediately before the “Loop” statement reads the next record in the file. Total_Customer_Count = Total_Customer_Count + 1 Total_Customer_Sales = Total_Customer_Sales + Customer_Sales Input #1, Customer_Name, Customer_Address, Customer_Sales Loop Place code inside the loop that processes the information in the record, as the following Visual Basic programming illustrates: In Visual Basic, for example, you use a “Do” statement to begin this kind of loop, as this code shows: ![]() Start a loop that terminates when the file reaches its end. It assumes that the CSV record has exactly three fields. Input #1, Customer_Name, Customer_Address, Customer_Sales The code that follows reads data into three variables: ![]() Visual Basic’s Input statement automatically detects the commas that separate each field in the CSV file. Read the first record in the file and load the record into suitable variables.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |