Tag Archives: WPF

How to loop through records in LINQ using VB.NET in Entity Framework

Here is a simple code snippet to loop through the records in VB.NET using LINQ


The following code example takes the records from an Entity Framework Model named as Video and then allows to loop through each record.



Dim List As List(Of Video)

List = (From video In db.Videos Order By video.ID Descending).ToList
For Each item In List

How to add Nuget Packages

How to Add Packages using NUGET in Visual Studio

Step 1

In Visual Studio Go to Tools > Library Package Manager > Manage Nuget Packages for Solution.


How to add Nuget Packages
How to add Nuget Packages


Step 2

You would get the following screen, you can check the packages which you have already available in your solution, you can search for new packages and install them to your solution.

Remember:  These packages need to be downloaded , each time you create a new Visual Studio solution


Packages in NUGET
Packages in NUGET

How to add a FAVICON in WordPress.

Favicon is the little icon which appears in the tab of your browser when you visit a website.





When people save your website URL as favourite, then this symbol will be displayed in the favourite in their browser, tablet or mobile device.

Step 1

If you do not have a FAVICON then just google  “create a favicon” and you would see lots of sites offering online creation tools.

Step 2

Go to your WordPress and click on Plugins

Click on Add New

Search for plugins Type in favicon.

I chose one called Captain Favicon.

Install it.

Activate it.


Step 3

There should be a button which suggest to upload the favicon. Upload the favicon which you created in step 1.

Upload and save.


Now you should be able to see your favicon when you browse your website.



Here is a short video showing the steps.

How to open second window from first window in wpf in C#?

This is how you would open a second window in WPF.

private void btnAppointmentPage_Click(object sender, RoutedEventArgs e)


//In this example we have already created a WPF Window and called
//it AppointmentsMain.xaml

AppointmentsMain AppointmentWindow = newAppointmentsMain();





How to use Select Case function to evaluate different conditions in VB.NET

If you have to select one of the options from various possibilities then your best option is to use the case

In VB.NET you would used something like below.

Select [ Case ] testexpression
[ Case expressionlist
[ statements ] ]
[ Case Else
[ elsestatements ] ]
End Select

Here is more practical example:

Dim intMyNumber as Integer = 20
Select Case intMyNumber
Case 1
Debug.WriteLine("The value of my number is 1")

Case 2,3,4
Debug.WriteLine("The value of my number is between 2 and 4.")

Case 5 to 9
Debug.WriteLine("The value of my number is between 5 and 9")

Case Else
Debug.WriteLine("The value of my number is not in 1 to 9")

End Select