Saturday, March 10, 2007

Hosting .Net Controls on Outlook Form Regions

If i am not wrong, VSTO v3 is going to support hosting .Net controls on outlook form regions. But, if you cant wait until then, you can try the ActiveX controls host thats posted on this yahoo group.
http://tech.groups.yahoo.com/group/vsnetaddin/files/VS.NET%20automation%20Shim%20Control/

I have seen this work. Worth a try.

Wednesday, February 21, 2007

This is cool


 

Posted this using OneNote 2007 and Word 2007

Custom formatting in DataGridView

I have a dataset that is returned by a web service. It contains a date column, among other columns, and this date is an UTC date(so, GMT time). Now, only when i display it in a datagridview, i need to display the local time depending on the user's local regional settings. Here is what I ended up doing....

// Bind the Cell formatting event
dgvGrid.CellFormatting += new DataGridViewCellFormattingEventHandler(dgvGrid_CellFormatting);


// Formatting event handler
void dgvGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)

{
if( e.Value.GetType() == typeof(DateTime) )

{
e.CellStyle.Format = "G";
// This is the key. Converts GMT time to local time by adding the offset.
e.Value = ((DateTime)e.Value).ToLocalTime();

}
}

Started...

I had nothing to do.. I had been wanting to blog for a long time now.. And fate just tied these two together. Here goes my first post.