Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Visual Basic Quickstart Guide

You're reading from   Visual Basic Quickstart Guide Improve your programming skills and design applications that range from basic utilities to complex software

Arrow left icon
Product type Paperback
Published in Oct 2023
Publisher Packt
ISBN-13 9781805125310
Length 238 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Aspen Olmsted Aspen Olmsted
Author Profile Icon Aspen Olmsted
Aspen Olmsted
Arrow right icon
View More author details
Toc

Table of Contents (27) Chapters Close

Preface 1. Part 1:Visual Basic Programming and Scripting FREE CHAPTER
2. Chapter 1: The Visual Basic Family of Programming Languages 3. Chapter 2: Console Input and Output 4. Chapter 3: Data Types and Variables 5. Chapter 4: Decision Branching 6. Chapter 5: Iteration 7. Chapter 6: Functions and Procedures 8. Chapter 7: Project Part I 9. Part 2:Visual Basic Files and Data Structures
10. Chapter 8: Formatting and Modifying Data 11. Chapter 9: File Input and Output 12. Chapter 10: Collections 13. Chapter 11: Project Part II 14. Part 3:Object-Oriented Visual Basic
15. Chapter 12: Object-Oriented Programming 16. Chapter 13: Inheritance 17. Chapter 14: Polymorphism 18. Chapter 15: Interfaces 19. Chapter 16: Project Part III 20. Part 4:Server-Side Development
21. Chapter 17: The Request and Response Model 22. Chapter 18: Variable Scope and Concurrency 23. Chapter 19: Project Part IV 24. Chapter 20: Conclusions 25. Index 26. Other Books You May Enjoy

Building the project in VB6

We will now build VB 6 code for the grading tool program. This code reads a CSV file of students and grades and stores them in a dictionary. It uses the Scripting.Dictionary object to create the dictionary and a Collection object to store the grades for each student.

Here’s the complete code, which reads the CSV file, stores the student names and grades in a dictionary, and then prints them with their corresponding grades:

Option Explicit
Dim studentGrades As Object
Sub ReadCSVFile()
    Dim filePath As String
    Dim fileNum As Integer
    Dim line As String
    Dim fields() As String
    Dim studentName As String
    Dim grade As String
    filePath = "students.csv"
    Set studentGrades = CreateObject
       ("Scripting.Dictionary&quot...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image