Apparently in Visual Studio 2005 you can only compile .NET Framework 2.0 applications. However, not rare is the case when you need to compile the application into .NET 1.1 and you don’t have Visual Studio 2003 installed. To be able to compile into .NET 1.1 with Visual Studio 2005 you will need to download the MSBee application […]
How to retrieve the state of Caps Lock, Num Lock and Scroll Lock keys
In order to know whether or not Caps Lock, Num Lock or Scroll Lock keys are on, we need to make use of the Win32 API through a call to an unmanaged function. Since we’ll make a call to an unmanaged function, the following using statement is in order: using System.Runtime.InteropServices;The following is the definition for the unmanaged […]
How to reset your MySQL root password under Windows
In case you forgot the root password for your MySQL database server running under Microsoft Windows, you can still access your database and even reset your password using the command prompt. However, first you should check your my.cnf file where your password is stored. If you are using a new version of MySQL Server, such […]
Understanding and Resolving ‘Exception Has Been Thrown by the Target of an Invocation’ in C#
If you’re a C# developer, chances are you might have come across this error message. It can be puzzling and sometimes frustrating. But don’t worry, we’re here to help you understand and solve it. In C#, exceptions are a way for the program to tell you that something unexpected happened. They are like warning signals. […]
How to check if a number is odd or even?
Advertisement More C# Resources The best way to see if a given number is odd or even is to use the modulus operator (%). The modulus operator returns the remainder when dividing two numbers. So if you do a modulus of 6 % 2 you get 0 because 6 divided by 2 doesn’t have a […]
How to validate a phone number in JavaScript
You can easily validate a TextBox against a phone number format, in JavaScript, using Regular Expressions (RegEx): <script type=“text/javascript”> function FormValidate(){ if(document.Form1.PhoneNumber.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1) { alert(“The phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.”); return false; } } </script> And the HTML markup that works with this script, is: <form […]
A list of keys and the JavaScript char codes they correspond to
This table is especially useful for those who want to capture the key press event in the browser window. These are the char codes JavaScript uses, and the keys they bind to: Char Key Name 8 Backspace 9 Tab 13 Enter 16 Shift 17 Ctrl 18 Alt 19 Pause 20 Caps Lock 27 Escape 33 […]
How do I make a JavaScript function wait before executing (sleep / delay)?
You’ll need to enclose the code that you want to execute after the delay in a function (Func1()). This function will then be called with a delay, in our case from another function (Func1Delay()). Then you simply call Func1Delay() which in turn calls Func1() but with a delay of 3000 milliseconds (3 seconds):
What is the Connection String for Connecting to a SQL Server 2005 Database?
The connection string needed for connecting to a SQL Server 2005 database (code name Yukon) is as follows: Where LOCALHOST\LOCAL is your SQL server address and LOCAL is the instance of the SQL Server (which can be named anything, but by default it is LOCAL).This normally works if you have the application that connects to […]
Index (zero based) must be greater than or equal to zero and less than the size of the argument list
Most of the time you get this error when you are trying to retrieve the selected value of a listbox (DropDownList) and no value is selected. Even though apparently the first item in a DropDownList is always selected by default, this is done by the browser and ASP.NET is not aware of the selected item. […]