public class ben:harrell

October 7, 2006

Object Data Source Gotcha

Filed under: Uncategorized — benjamin harrell @ 10:37 pm

So you just created your super cool Business Object and you want to bind some control to it but when you add new data source you can’t see your object!!!

Not to worry, if you can’t see your object try this:

  1. cancel out of the dialog
  2. rebuild your project
  3. now re-add the datasource

Not sure how or why but, as usual, Visual Studio is caching objects :)

Team Foundation Server install – where is kb912838?

Filed under: Uncategorized — benjamin harrell @ 10:34 pm

…it is in the sql server kb folder called kb 914595

TreeView Render Speed

Filed under: .NET, Technology — benjamin harrell @ 10:15 pm

Here is a quick tip when doing large updates and adds to the Windows Forms Treeview control. Use the beginupdate() method to “turn off” rendering and then after your changes are complete use the endupdate() method to turn rendering back on which will then render all of your changes.

Sometimes it is necessary to do this for a control that doesn’t have these wonderful methods but no to worry you can easily derive a control, add your own “flag” variable and then just override the OnPaint method and if your variable is set to not render then simply return from OnPaint. I have also added the Begin and EndUpdate methods below for setting the variable. If you want to force the control to repaint then you can call EndUpdate( true ). Here is a sample :

public class FastDrawTreeView : System.Windows.Forms.TreeView
{
private bool _disableRendering = false;

public void BeginUpdate()
{
_disableRendering = true;
}

public void EndUpdate(bool redraw)
{
_disableRendering = false;
if (redraw)
this.Refresh();
}

protected override void OnPaint(PaintEventArgs e)
{
if (_disableRendering)
return;
base.OnPaint(e);
}
}

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.