Head 'Em Off at the Pass

Listing 1. You can modify bound data values before display by handling the Format event of a Binding object. Handle a Binding object's Parse event to do the same thing with the underlying data source.

private void OnLoad(object sender, 
	System.EventArgs e)
{
	txtFirstName.DataBindings.Add("Text",
		m_dsAuthors.Tables["Authors"],"au_fname");
	txtLastName.DataBindings.Add("Text",
		m_dsAuthors.Tables["Authors"],"au_lname");
	txtCity.DataBindings.Add("Text",
		m_dsAuthors.Tables["Authors"],"city");
	Binding b = new Binding("Text",
		m_dsAuthors.Tables["Authors"],"state");
	b.Parse +=new ConvertEventHandler(ParseState);
	b.Format += new 
		ConvertEventHandler(FormatState);
	txtState.DataBindings.Add(b);
}
private void ParseState(object sender, 
	ConvertEventArgs e)
{
	e.Value = ((string)e.Value).ToUpper();
}

private void FormatState(object sender, 
	ConvertEventArgs e)
{
	e.Value = ((string)e.Value).ToUpper();
}