Is it possible to cache an assembly to improve performance?

Ngen.exe allows you to install the native image of an assembly into the native image cache, resulting in quicker loading and execution of the assembly. For example: ngen [options] [assemblyName | assemblyPath ] ngen MyAssembly.dll This creates a native image for MyAssembly.dll and installs it to the native image cache. ngen /delete MyAssembly.dll This removes the native image from the cache. It is also important to note that the native image must be created on the end user’s machine, as it is based on the system that creates it.

How can I make the Enter Key behave like the Tab Key and move to the next cell

You can override ProcessCmdKey, catch the Enter Key, and swap it for a Tab key by sending a Tab, and not processing the Enter Key. [C#] public class MyDataGrid : DataGrid { protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) { if(msg.WParam.ToInt32() == (int) Keys.Enter) { SendKeys.Send(‘{Tab}’); return true; } return base.ProcessCmdKey(ref msg, keyData); } } [VB.NET] Public Class MyDataGrid Inherits DataGrid Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, keyData As System.Windows.Forms.Keys) As Boolean If msg.WParam.ToInt32() = CInt(Keys.Enter) Then SendKeys.Send(‘{Tab}’) Return True End If Return MyBase.ProcessCmdKey(msg, keyData) End Function ’ProcessCmdKey End Class ’MyDataGrid

How do I use the CSV clipboard format supported by Excel

In this case, the dataobject is a memory stream. Here are code snippets that allow you to get/set CSV values from/to the clipboard in a manner compatible with Excel. [C#] private void GetCSVFromClipBoard_Click(object sender, System.EventArgs e) { IDataObject o = Clipboard.GetDataObject(); if(o.GetDataPresent(DataFormats.CommaSeparatedValue)) { StreamReader sr = new StreamReader((Stream) o.GetData(DataFormats.CommaSeparatedValue)); string s = sr.ReadToEnd(); sr.Close(); Console.WriteLine(s); } } private void CopyCSVToClipBoard_Click(object sender, System.EventArgs e) { String csv = ‘1,2,3’ + Environment.NewLine + ‘6,8,3’; byte[] blob = System.Text.Encoding.UTF8.GetBytes(csv); MemoryStream s = new MemoryStream(blob); DataObject data = new DataObject(); data.SetData(DataFormats.CommaSeparatedValue, s); Clipboard.SetDataObject(data, true); } [VB.NET] Private Sub GetCSVFromClipBoard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim o As IDataObject = Clipboard.GetDataObject() If Not o Is Nothing Then If (o.GetDataPresent(DataFormats.CommaSeparatedValue)) Then Dim sr As New StreamReader(CType(o.GetData(DataFormats.CommaSeparatedValue), Stream)) Dim s As String = sr.ReadToEnd() sr.Close() Console.WriteLine(s) End If End If End Sub ’GetCSVFromClipBoard_Click Private Sub CopyCSVToClipBoard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim csv As String = ‘1,2,3’ + Environment.NewLine + ‘6,8,3’ Dim blob As Byte() = System.Text.Encoding.UTF8.GetBytes(csv) Dim s As New MemoryStream(blob) Dim data As New DataObject() data.SetData(DataFormats.CommaSeparatedValue, s) Clipboard.SetDataObject(data, True) End Sub ’CopyCSVToClipBoard_Click

How can I create non-rectangular windows

Check out this Microsoft KB article, Shaped Windows Forms and Controls in Visual Studio .NET There are 2 ways to create non-rectangular windows: 1) The Control.Region property (Form inherits this of course): [CS] GraphicsPath gp = new GraphicsPath(); gp.AddEllipse(0,0,100,100); gp.AddRectangle(50,50,100,100); this.Region = new Region(gp); [VB.NET] Dim gp As New GraphicsPath() gp.AddEllipse(0, 0, 100, 100) gp.AddRectangle(50, 50, 100, 100) Me.Region = New [Region](gp) 2) Use the Form.TransparencyKey property. This tells the form not to paint any pixels that match the color of the TransparencyKey. So you can make your fancy skin bitmap, then set the TransparencyKey to be, say Color.Red, then all the pixels that are RGB(255,0,0) will be transparent. (from [email protected] on microsoft.public.dotnet.framework.windowsforms)