Posts

Showing posts with the label VB.NET

Donate

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And VB.NET

Image
Good day guys! Here's the VB.NET version of this article WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET which is a CRUD (Create,Update and Delete) application using the DataGrid control, ADO.NET Entity Framework 6.x and Model–View–Viewmodel(MVVM) architectural pattern. The project structure and the logic were derived from that article except that this application incorporates Visual Basic.NET/VB.NET as the programming language. I. Project Setup 1. Create a table in your database called Students using the script from this post WPF CRUD With DataGrid, Entity Framework And C#.NET . 2. Create a WPF Project and add four folders called DataAccess, Model, View and ViewModel. The project structure may resemble with the screenshot provided below. II. Coding The Model and Repository Class 1. Inside the Model folder, add an ADO.NET Entity Data Model object that connects to the Students table in your database. On my part, I named it StudentModel . 2. Fo

Read Files From Google Photos Using Google Photos API, REST And VB.NET

Image
This is the VB.NET version of the post Read Files From Google Photos Using Google Photos API, REST and C#.NET . In your VB.NET project, you need to reference the Google.Apis.Auth package via NuGet and attach the JSON file that contains the Google API credentials. The models used for converting a JSON response to .NET object are shown below. Public Class clsResponseRootObject Public Property mediaItems As List( Of MediaItem) Public Property nextPageToken As String End Class Public Class MediaItem Public Property id As String Public Property productUrl As String Public Property baseUrl As String Public Property mimeType As String Public Property mediaMetadata As MediaMetadata Public Property filename As String End Class Public Class MediaMetadata Public Property creationTime As DateTime Public Property width As String Public Property height As String Public Property photo As Phot

MVVM RelayCommand And ViewModelBase Classes in VB.NET

Good evening! Here's a conversion of the RelayCommand and VewModelBase classes to VB.NET as reference for VB.NET programmers. RelayCommand Imports System.Windows.Input Public Class RelayCommand : Implements ICommand Private ReadOnly _execute As Action( Of Object ) Private ReadOnly _canExecute As Predicate( Of Object ) Public Sub New ( ByVal execute As Action( Of Object )) End Sub Public Sub New ( ByVal execute As Action( Of Object ), ByVal canExecute As Predicate( Of Object )) If execute Is Nothing Then Throw New ArgumentNullException( "execute" ) _execute = execute _canExecute = canExecute End Sub Public Function CanExecute ( ByVal parameter As Object ) As Boolean Implements ICommand.CanExecute Return (_canExecute Is Nothing ) OrElse _canExecute(parameter) End Function Public Custom Event CanExecuteChanged As EventHandler Implements ICommand

WPF CRUD With DataGrid, Entity Framework And VB.NET

Image
Good morning! Here's the VB.NET version of this post WPF CRUD with DataGrid and Entity Framework C# . The steps to accomplish basing from the C# post are: a. Run the create table script assuming that you haven't created the Students table. b. Create a VB.NET WPF project. c. Replace the XAML markup of the window control. Once done, the scripts for the repository class and window code-behind are as follows: Repository Class Public Class StudentRepository Private studentContext As StudentEntities = Nothing Public Sub New () studentContext = New StudentEntities() End Sub Public Function GetStudent ( ByVal id As Integer ) As Student Return studentContext.Students.Find(id) End Function Public Function GetAll () As List( Of Student) Return studentContext.Students.ToList() End Function Public Sub AddStudent ( ByVal student As Student) If student IsNot Nothing Then

Donate