Visual Basic Online Courses DataGridView Add Edit Delete

VB .NET DataGridView Add Edit Delete

Manipulate DataGridView from Visual Basic 2010 with SQL Server

DataGridView Add, Edit, Delete From Database
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

1) Create a new Visual Basic project (Windows Application) name it as (MyDg1) and save it to your hard drive.
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)




Visual Basic Online Courses
vb.net DataGridView Project From Inside VB.Net 2005

Visual Basic Courses Online
DataBase (MyDB) & Table (Kinds) From Inside SqlServer

Courses of Visual Basic online
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
2) For Editing : you Edit a cell that already have been saved and hit enter
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 :

Codes above works 100% just create the database and the table and the record successfully,


vb.net Datagridview source code download
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 :

Popular posts from this blog

Visual Basic 2010 Working With DataBase Full Project Example

VB NET Check internet connection

VB .NET DropBox Api Source Code Example

Visual Basic .Net - Button Sound / Music Play

VB .NET WebView2 WinForms tips