Visual Basic Online Courses DataGridView Add Edit Delete
VB .NET DataGridView Add Edit Delete
Manipulate DataGridView from Visual Basic 2010 with SQL Server
Visual Basic Online Course - DataGridview SQL Server Database |
Note :
If you don't know how to work SQL Server With VB .NET : You need to see this then this
Logic
Using DataGridView Control In VB .NET to Add New - Edit - Delete from/to SQL Server Database or MS-Access or any other Database type. You will find in the end of the lessons the project to download along with source code .
Design
2) Place a DataGridView Control on the Form1.
3) Create SQL Server Database file, name it (MyDB)
4) Create Table, name it (Kinds) with just one record, name it (Kinds)
5) Rename the DataGridView Control's name From (DataGridView1) to (DG1)
6) Save/Build the project .
7) Now you have: A project such as this one in the 3 photos (from inside VB .NET and from Outside)
vb.net DataGridView Project From Inside VB.Net 2005 |
DataBase (MyDB) & Table (Kinds) From Inside SqlServer |
Project Folder on Desktop With Database Inside |
- What do we want to do ?!!!!
we want to update the database (MyDB) Table (Kinds) Record (Kind) using DataGridView (DG1) From MS Visual Basic .Net 2005 on WinXpSp2 Home Edition ........ ahahahaha ok?!!
We will use NO buttons, we will only use DG1 Events :
1) For Adding New Record : you type in the cell in the dg1 and hit Enter Key
3) For Deleting : you Select a cell in the DG1 and you hit Delete key in the keyboard .
* Of course you can not add Empty Values because we have the record (Kind) is Primary Key (PK) .
* You can not Delete the (New DG1 Row) ...
All you have to do now is to open the Form1 Code and Clear all lines using (Ctrl+A) and (BackSpace) then Save Project (Ctrl+S) then Paste (Ctrl+V) these blocks of Codes :
vb.net Datagridview source code download |
The example tested with vb2010
Download Full Example : MediaFire.com Link
Function to Fill DataGridView with Table using DataTable
Resize Image in DataGridView
♥ Here are some online Visual Basic lessons and courses :
- Visual Basic .Net snippets collection
- Visual Basic .Net - How to check for the internet connection
- Visual Basic .Net - POP3 and Receiving E-mails
- Visual Basic .Net - Generate Random Combinations
- Visual Basic .Net - Play sounds on Button Click or Mouse Hover
- Visual Basic .Net - Progressbar control
- Visual Basic .Net Solution - The application failed to initialize
- Visual Basic .Net - Working with Database full example
- Visual Basic .Net - There is already an open DataReader associated
- Visual Basic .Net - SyBase Advantage Database [Add, Edit, Search, Delete and DataGridView]