Wednesday, July 11, 2007

ASP.NET DataGrid ButtonColumn creating blank webpage

I encountered an odd bug while using Visual Studio 7.1.3088. Changing a datagrid's column type from BoundColumn to ButtonColumn turned the page to a white page with a lot of source code missing. The cause was for some reason code in the InitializeComponent was being erased.

private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}

was being changed into an empty function.

private void InitializeComponent()
{

}


Adding the code back in fixed the page.

Monday, February 06, 2006

simple MS word macro

Begin with either Alt+F8 or Tools/Macro/Macros...
Type in a name for your macro.
Enter code for you macro, such as:

Sub poly()

Dim x As Integer
x = 0
max = 1000

While x < (max - 1) x = x + 1 Selection.TypeText Text:="coolness for " + CStr(x) + " and " Wend Selection.TypeText Text:="coolness for " + CStr(max) + "." End Sub


CStr() is Words funtion for turning a variable into a string.

Saturday, October 22, 2005

changing the value of an unknown datatype

use .GetType(); to find out what you're working with:
collection.items[0].GetType().ToString();

use this type to create a new variable:
TextBox myItem = new TextBox();

either add or reset the item into the collection:
collection.items[0] = myItem;
collection.items.add(myItem);