Tag: How to

How to detect if a key exists in a Dictionary in C# ?

If you want to detect if a key exists in a dictionary in C# , you can use the contains method of the dictionary which return true if the key is found. How to detect if a key exists in a Dictionary in C# ? Below is a sample source code that illustrates how to find out if the exists in a dictionary using the…

Built-in method to validate email address in C#

Are you looking for a built-in method in C# which lets you validate email address. If yes , you can use the EmailAddressAttribute class that is defined in the System.ComponentModel.DataAnnotations namespace to do it. How to validate email address in C# using EmailAddressAttribute class ? Below is a sample code snippet demonstrating the usage of the EmailAddressAttribute class to validate the email address in C#.

How to change positive numbers to negative in Microsoft Excel 2016 ?

Do you want to change the positive numbers to negative numbers and vice versa (or in simple terms) , reverse the sign of the numbers in Microsoft Excel 2016 ?. This blog post will provide you a simple tip on how to do it using the Paste special function. How to change positive numbers to negative in Microsoft Excel 2016 ? 1. Type the number…

Using BETWEEN clause to specify range of values in SQL Query

In SQL Server 2014 , you can use the BETWEEN clause to specify a range of values in the search criteria. How to specify a range of values in a Query in SQL Server ? For example , you want to to query the Employee table to display the employees having the birthdate between 1969-01-29 and 1975-12-01′ , you can use the BETWEEN clause as…

How to Create a Guid Value in C# ?

If you want to create a new Guid value in C# which is random , you can use the Guid class to achieve it. Below is a sample code snippet demonstrating how to do it. How to Create a Guid Value in C# ?

How to get the Machine Name from a .NET Application using C# ?

You can use the MachineName property defined in the System.Environment class in order to get the Machine Name from your .NET Application. How to get the Machine Name from a .NET Application using C# ? Here’s a code sample demonstrating how to do it. This should display the machine name. The output of the program would be The Machine Name is Abundantcode-LT

How to run the Universal App outside Visual Studio in Windows 10 ?

The Windows Store App built using the Universal App template in Visual Studio 2013 produces the .exe file which is available in the bin folder but when you double click on this exe folder , you will get an error message stating that “This application can only run in the context of an app container.” How to run the Universal App outside Visual Studio in…

Connecting to a Database in SQL Server Management Studio

Most of the time you will be connecting to your database when working in SQL Server Management Studio. You want to know how to connect to a particular database in SQL Management Studio when working with SQL Server 2014 and executing a query. For example , you want to connect to the AdventureWorks2014 database. How to connect to a database in SQL Management Studio in…

How to sort an array using Comparator in C# ?

The Array.Sort method lets the developers pass the comparator which can be used to sort an array of objects. How to sort an array using Comparator in C# ? In the below example , the method CompareByName is used which lets the Array.Sort method to sort the array of objects in descending order.

How to hide virtual keyboard in android using Java?

There are times when you want to hide the virtual keyboard in android. You can easily do that using the InputMethodManager. How to hide virtual keyboard in android using Java ? Just call the hideSoftInputFromWindow method of the InputMethodManager class by passing the token of the current window that contains the focussed view. Below is a sample code snippet demonstrating the usage of InputMethodManager to…

C Program to find the LCM of two numbers

Problem Write a program in C to find the LCM(Lowest common multiples) of the two numbers given by the user. How to find the LCM of two numbers in C ? Lowest common multiples of two integers refers to the smallest numbers that is perfectly divisble by both the numbers given as input where the value of the remainder is zero. Here’s a program in…

How to Get Unique Device ID from Windows Phone 8 Using C#?

Do you want to get the unique device id of the Window phone 8 programatically using C#? , you can do it using the DeviceExtendedProperties defined in the Microsoft.Phone.Info name and use the “DeviceUniqueId” property name to get the device id in byte array and then convert it to base 64 string . How to Get Unique Device ID from Windows Phone Using C#? Below…