November 7, 2009

Quickly Determine Whether a Column Is Fully Visible in a DataGridView

It’s easy to determine whether a DataGridView column is invisible—just check its Boolean Displayed property. However, the Displayed property returns True even when the column is only partially visible in the screen. You can use the DataGridView.GetColumnDisplayRectangle method to create a solution for this problem. The second parameter to GetColumnDisplayRectangle

Create ASP.NET Dynamic Hyperlinks from URLs Stored in Web.Config

Consider storing any URLs used by your application in the web.config file?where you can easily update them?and then using them to create hyperlinks in your web site dynamically. To do that, you need to decide exactly how to store and retrieve the URLs. Here’s one method. In the web.config file,

Detect Recursive Calls in Your .NET Code

Here’s a way you can check whether the current method is recursive. The following method returns True when your application is in a recursive method: Public Function CheckRecursion() As Boolean Dim myTrace As New System.Diagnostics.StackTrace() ‘If stack layer count less 3 , recursion impossible. If myTrace.FrameCount < 3 Then Return