How can I select the entire row when the user clicks on a cell in the row

Call the DataGrid.Select method from within its mouseup event. [C#] private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { System.Drawing.Point pt = new Point(e.X, e.Y); DataGrid.HitTestInfo hti = dataGrid1.HitTest(pt); if(hti.Type == DataGrid.HitTestType.Cell) { dataGrid1.CurrentCell = new DataGridCell(hti.Row, hti.Column); dataGrid1.Select(hti.Row); } } [VB/NET] Private Sub dataGrid1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dataGrid1.MouseUp Dim pt = New Point(e.X, e.Y) Dim hti As DataGrid.HitTestInfo = dataGrid1.HitTest(pt) If hti.Type = DataGrid.HitTestType.Cell Then dataGrid1.CurrentCell = New DataGridCell(hti.Row, hti.Column) dataGrid1.Select(hti.Row) End If End Sub

How do I programmatically scroll the datagrid to a particular row

The DataGrid has a protected GridVScrolled member that can be used to scroll the grid. To use it, you can derive from DataGrid and add a ScrollToRow method. Here is a code snippet. Public Class MyDataGrid Inherits DataGrid Sub ScrollToRow(ByVal row As Integer) If Not Me.DataSource Is Nothing Then Me.GridVScrolled(Me, New ScrollEventArgs(ScrollEventType.LargeIncrement, row)) End If End Sub End Class This solution uses information provided by Daniel Herling (MS) in the microsoft.public.dotnet.framework.windowsforms.databinding newsgroup.

How do I add an application to the Window’s Tray

In design mode, you drop a NotifyIcon object on your form. You can then drop a ContextMenu on your form and add this menu to the NotifyIcon’s ContextMenu property. This menu will be seen when the user rightclicks the try icon. You can add a handler for the NotifyIcon’s Click event to catch the action of a user clicking the icon. From code, you create an instance of NotifyIcon, set properties, hook any handlers you want, and then make it visible. Here are some VB snippets. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim trayItem As NotifyIcon = New NotifyIcon() trayItem.Icon = SystemIcons.Question trayItem.Visible = True AddHandler trayItem.Click, New EventHandler(AddressOf HandleTrayClick) End Sub Private Sub HandleTrayClick(ByVal sender As Object, ByVal e As EventArgs) MessageBox.Show(‘Tray item clicked’) End Sub

How do I set the color and font in a RichEditBox

You use the SelectionFont and SelectionColor properties. Make sure the control had focus. Then the following code will set the currently selected text to a red-bold-courier font. If no text is currently selected, then any new text typed (or inserted) will be red-bold-courier. [C#] richTextBox1.Focus(); richTextBox1.SelectionColor = Color.Red; richTextBox1.SelectionFont = new Font (‘Courier’, 10, FontStyle.Bold); [VB.NET] richTextBox1.Focus() richTextBox1.SelectionColor = Color.Red richTextBox1.SelectionFont = new Font (‘Courier’, 10, FontStyle.Bold)

How can I draw without handling a paint message

To draw on any hwnd, you need to get a Graphics object from that hwnd. Once you have the Graphics object, you can then use its methods to draw. Of course, since this drawing is not done in the Paint handler, it will not be automatically refreshed when the control is redrawn for any reason. Graphics g = Graphics.FromHwnd(this.Handle); SolidBrush brush = new SolidBrush(Color.Red); Rectangle rectangle = new Rectangle(25, 25, 100, 100); g.FillRectangle(brush, rectangle);