rendered paste bodyusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication7
{
public partial class UserControl1 : UserControl
{
private Product m_BoundProduct;
public UserControl1()
{
InitializeComponent();
}
public Product Product
{
get { return m_BoundProduct; }
set
{
if ( m_BoundProduct != value )
{
ClearBindings();
m_BoundProduct = value;
if ( m_BoundProduct != null )
{
Bind();
}
}
}
}
private void ClearBindings()
{
this.textBox1.DataBindings.Clear();
}
private void Bind()
{
this.textBox1.DataBindings.Add( "Text", m_BoundProduct, "Name", true, DataSourceUpdateMode.OnPropertyChanged );
}
}
}