Learn WPF CRUD Operations Using VB.NET

In this article, we are going to:

  • Create a database.
  • Create stored procedures.
  • Create a WPF application in VB.NET.
  • Perform CRUD operations.
Create a Database

Open SQL Server 2016. Then, click the New Query window and run the below query.

Create Stored Procedures

You’ve probably used Entity Framework, but I have written the stored procedure for my data operations, so run the below SP.

 Create a WPF Application in VB.NET

Open Visual Studio 2015. Go to New Project > Visual Basic (under templates) > WPF Application.


After creating the application, open the Solution Explorer, which appears like the below image. Now, we are ready to create our design screen.


Here, I am using simple WPF controls:

  • Textbox.
  • Rich textbox.
  • Button.
  • Datagrid.
  • Label.
  • Date picker.

Then, write the following XAML code in MainWindow.xaml file.

 Perform CRUD Operations

Create a Model folder in Solution Explorer and create a new VB.Class there.

Declare global variables and connection strings in the class.

You can validate the textbox and rich textbox controls and add, update, and Delete events.


Copy and paste the below code in the “add” button event.

I will reuse the same method & passing different mode to SP for each event (Update & Delete).

Let’s retrieve the data from database using DataGrid. Load_Grid calls to all the events.

You must use  Binding="{Binding XXX}" in VB.Net WPF DataGrid control.

In DataGrid, by using the mousedoubleclick event for editing the recorders, data can be retrieved by employee ID.

After completing the above steps, run the application.



In this article, we saw how to perform WPF CRUD operations using VB.NET. If you have any queries, please comment below.

Happy Coding!

Thiruppathi Rengasamy
I'm a Dotnet Developer & Blogger. And also I'm working as a senior software engineer. I would like to spend my precious time writing articles, research on .Net technologies, and learning new technologies.