VB.Net - w4111/w4111.github.io GitHub Wiki
Chenhai Mu, CM4391 - All
Background
VB.NET (Visual Basic.NET) is a contemporary programming language created by Microsoft. It is built on the .NET framework and allows for the quick construction of various applications. It combines the simplicity and convenience of standard Visual Basic with object-oriented programming (OOP) ideas, enabling developers to design robust and complicated solutions easily. W4111's project utilizes Python with embedded SQL (e.g., SQLite or PostgreSQL) for database interactions. However, VB.NET provides a distinct development method with considerable benefits in some areas:
- Rapid User Interface Development: Visual Studio's drag-and-drop control design reduces the need to learn extra HTML/CSS and JavaScript.
- Integrated Development Environment: Development, debugging, and UI design are all done on the same platform, which reduces tool-switching complexity.
- Transactional Support and Security: The built-in TransactionScope and parameterized queries provide effective transaction management and SQL injection protection.
- ADO.NET supports direct connections to popular databases such as SQL Server and MySQL, which reduces setup costs.
These qualities make VB.NET a good option for creating desktop database-driven apps, especially when requiring quick iteration and direct user involvement.
NET Development Platform
The .NET development platform comprises the .NET framework (.NET Framework),. .NET programming technologies, and .NET development tools. The Figure below shows that the.NET framework, including the Common Language Runtime (CLR) and the Base Class Library, is the backbone for the whole development platform. .NETT development technology introduces a new database access mechanism. ADO.NET and Web Application Development Technology ASP.NET, which uses XML technology, has paved the way for a new generation of electronic data exchange standards and enabled network computing. In terms of development tools,.NET supports a variety of languages, including Visual Basic, Visual C++, Visual C#, and Visual J# (also known as VB, C++, C#, and J#), and Visual Studio.NET is a development tool that fully supports.NET.
NET Developer Platform Characteristics
- Support for many programming languages: Programmers may utilize their preferred programming language or a combination of languages while developing an application. Modules created in many languages may be readily merged.
- Multi-application development: Multiple apps may be produced in Visual Studio.NET using any language programming environment, including Windows applications and ASP.NET programs, which are also known as .NET programs.
- Use the same base class library: In conventional language programming environments, various languages have distinct function libraries, and the calling techniques vary. Therefore, the function libraries of multiple languages are incompatible. Modern programming depends significantly on reusable code from libraries, and object-oriented languages make it easier to create class libraries. The .NET framework offers hundreds of reusable classes, and both VB and C++ utilize the same fundamental class library to develop numerous applications.
- Common Language Runtime (CLR): The runtime library offers program execution services and a unified programming language implementation. NET programs must be built twice before they may be executed on the CPU. They are first compiled into a CPU-independent intermediate language (MSIL) program; with the help of the CLR, the intermediate language program is then converted into a program consisting of native CPU instructions to achieve. NET's cross-platform operation.
Why Might Choose VB.NET Over Python and Database Tools?
Python is a popular tool for constructing database-driven applications, particularly when paired with SQLite or PostgreSQL. However, VB.NET thrives in specific contexts owing to its inherent advantages:
Comparative Analysis
Unique Features of VB.NET
-
Visual Studio's drag-and-drop tool simplifies UI construction, eliminating the need for HTML/CSS or frontend framework experience.
- VB.NET outperforms Python's Tkinter and PyQt regarding development speed and usability.
-
Transaction Management and Database Interaction: - VB.NET's ADO.NET supports native transactions (e.g., 'TransactionScope'), reducing human transaction logic requirements.
- Python needs explicit database transaction instructions, which raises the danger of missing rollback logic in complicated processes.
-
End-to-End Integration: Visual Studio combines coding, UI design, and debugging into a unified experience.
- Python programming often requires moving between IDEs (such as PyCharm) and database administration tools (such as pgAdmin), complicating the process.
Using VB.NET for W4111 Project:
The Project Context
As a hypothetical example, imagine we are building a Library Management System for the W4111 project to demonstrate how VB.NET manages the creation of a database-driven desktop application.
-
Functional Requirements:
- Maintain book and user information.
- Record tracking is used to facilitate book borrowing and return.
- Create user-friendly interfaces for querying, adding, and updating data.
-
Why VB.NET:
- Python's GUI frameworks (e.g., Tkinter) are inefficient for creating intuitive desktop interfaces.
- The built-in support for VB.NET simplifies transaction-centric operations.
- Visual Studio's drag-and-drop capabilities considerably reduce the development time.
Steps
1. Database design and implementation
During the database design phase, the library management system's key entities and relationships are established using relational models. This includes:
- Book Table: Contains book information such as title, author, and publishing year.
- User Table: Contains user information like name and email.
- Borrow Record Table: Records book borrowing and return operations, connecting books to users.
Example SQL table structure:
2. Implementation using VB.NET
UI Design
We rapidly developed the application's interface using Visual Studio's drag-and-drop features.
- DataGridView: Shows query results, such as book details or borrowing data.
- TextBox and Button: Enable user inputs (such as search queries) and trigger functions.
Core Code Examples
1). Loading Book Data:
2). Creating a New Book:
3). Transaction Support for Borrowing Books:
Conclusion: Key Advantages of VB.NET
The preceding sample highlights VB.NET's unique features in:
- Development Efficiency: Quick UI design using drag-and-drop tools.
- Database Interaction: Full SQL and transaction support via ADO.NET.
- Debugging Tools: Visual Studio provides real-time debugging, which improves the development and testing experience.
We chose VB.NET because of its integrated ecosystem, which allows us to easily construct a feature-rich database application. This makes it an ideal option for desktop applications that need direct database contact.
- Tutorial Resources: https://www.youtube.com/@VBToolbox
- Download for free: https://microsoft-visual-basic.en.softonic.com/download