VB.NET

Access Master Page properties from the content page

Many times you need to access a control in your master page from the content page (like setting a page title or adding specific META tags). Most tutorials will show you that you can just use the Page.Master FindControl() method to do something like this:

// get the control by searching the master page collection.
Label lblControlToFind = (Label)Page.Master.FindControl("lblPageTitle");
 

GridView ObjectDataSource LINQ Paging and Sorting

If you've attempted to create your own Data Access Layer for LINQ and want to use the built-in data binding for .NET controls like a GridView, you know the nightmare of trying to get these controls to work together with LINQ new IQueryable interface. After much pain and suffering, I was able to cobble together little tidbits from various posts to create a solid object that can be used as a "codeless" ObjectDataSource for any GridView AND support sorting, paging, and filtering just like if you were to databind to a LINQ to SQL object (like EVERY tutorial shows you how to do).

Setting a Windows Form Opacity

Here's how to set a form's opacity so you can "fade-out" a form like you see with so many windows applications, notification and popup boxes, outlook email notifications, etc. It's pretty simple:

- Add a private member to the class:

private int m_iFadeCount;

- Add a timer object to the form and call it "timerFade"

- Set the Interval property to 25 (that is milliseconds between when the timer will fire). NOTE: You can use any value but in my testing 25, seemed to be the most like other windows fade effects.