Tips & Tricks

146 posts

“Setup cannot copy the file staxmem.dll” error when installing IIS on XP

When I tried to install IIS on my laptop which is running Windows XP Pro SP2, I got this error during the installtion: “Copy error Setup cannot copy the file staxmem.dl_. Ensure that the disk labeled ‘Windows XP Professional Service pack 2 CD’ is in the drive selected below, or provide the location where the file can be found.” After some search on the Internet, it turned out it is a very common error that […]

It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level

When launching a web application, an error like this shows up: It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS. There are several causes for this error: 1. Just like the error says, the virtual directory in IIS is not an application folder. To fix, just go to IIS and expand “Default Website” […]

Generate Random Text in Word 2007

A very handy tip I got via email from Microsoft. On a blank line in a Microsoft Office Word document, type =rand followed by (PC,SC)—where PC stands for paragraph count and SC stands for sentence count—and then press ENTER. For example, =rand(2,3) will create two paragraphs of three sentences each. Word inserts some random text based on your specification. You can use this new text for testing form controls such as text boxes or paragraph […]

Prevent browser from remembering inputted data in text box

Browser has a handy feature that remembers the information entered earlier in text boxes, and this feature can save you a lot of time when you fill up a form on-line. Sometimes, however, this feature may cause unwanted behaviors, even security concerns. For example, browser should not remember the credit card number that was entered. Another example is if you have a RegularExpressionValidator to validate a text box field, and if the text box has […]

How to change the information in browser’s status bar

I came across a question asking how to change browser’s window status information when user moves the mouse over a button on an ASP.NET web page. The solution is to use JavaScript.In the Page_Load event handler, add the following two lines of code: Button1.Attributes.Add(“OnMouseMove”, “javascript:window.status=’Message’;”) Button1.Attributes.Add(“OnMouseOut”, “javascript:window.status=’Done’;) Note, the solution only works in Internet Explorer. FireFox by default disables the ability to change the status bar, because the status bar has been abused by spammers.

[WinForm] How to dynamically add a drop down list in datagridview control

Scenario: You need to dynamically add a drop down list in a DataGridView control in a WinForm. Requirements: The items of the drop down list are dynamically bound with data from database. Solution: 1. Connect to database and retrieve data into a datatable, i.e. dtRanks; 2. Create a DataGridViewCombBoxColumn, set necessary properties of the CombBox column, then add it to the GridView control: DataGridViewComboBoxColumn ranks = new DataGridViewComboBoxColumn(); ranks.DataPropertyName = “TestID”; ranks.Name = “TestID”; ranks.HeaderText […]

MS SQL Server Express Error 5123 When Attaching a Database

I have been using MS SQL Server Management Studio Express to attach and detach my database for some time and have not had any problems until today. When I tried to attach a database, MS SQL Server Management Studio Express gave me error 5123: Failed to retrieve data for this request. (Microsoft.SqlServer.Express.SmoEnum) Additional Information: … CREATE FILE encountered operating system error 32(The process cannot access the file because it is being used by another process.) […]

MSDTC on server ‘\SQLEXPRESS’ is unavailable

I am currently working on a Windows application with C# and MS SQL Server 2005 Express as the back-end database. It’s been working fine until today when it gave me an error message when I tried to update a datatable. The error message is: MSDTC on server ‘(server name)\SQLEXPRESS’ is unavailable. According to Microsoft SQL Server 2005 Express Edition with Advanced Services Readme (see section 3.4), the cause of the error is: Because the Microsoft […]

WordPress 2.3 is out

Just before going to bed, I turned on my computer to check my emails and to check my blog stats, which is my daily routine before the day is out. I noticed that WordPress 2.3 is released. This version is named “Dexter” for the great tenor saxophonist Dexter Gordon. I am very excited about this new version, and cannot wait to upgrade my current version. Unfortunately, it’s about mid-night now, and I should be in […]

Type special symbols in Visual Studio .NET text editor

Have you ever had this problem that you need to type some special symbols in Visual Studio .NET text editor? Such as ©, ®, ±, à, À, and the list goes on. Of course, if you are working on an ASPX file, you can always use the HTML editor and type in their HTML names or HTML numbers, and Visual Studio .NET will automatically convert them to those special symbols (VS 2005 does a much […]