HomeActive Query BuilderDetect alias changed

Detect alias changed


Is there any possibility to detect when user is changing alias of the table (by editing datasource properties?)
Rex
April 3 2009, 04:21 AM
Dear Rex,

You need to handle BeforePropertiesDialog and AfterPropertiesDialog events:


String prevAlias;

private void queryBuilder1_BeforePropertiesDialog(QueryBuilder sender, ControlOwner controlOwner, ref bool abort)
{
if (controlOwner is DataSource)
{
DataSource ds = (DataSource) controlOwner;

prevAlias = ds.Alias;
}
}

private void queryBuilder1_AfterPropertiesDialog(QueryBuilder sender, ControlOwner controlOwner)
{
if (controlOwner is DataSource)
{
DataSource ds = (DataSource) controlOwner;

if (prevAlias != ds.Alias)
{
MessageBox.Show("Alias changed. Old: \"" + prevAlias + "\". New: \"" + ds.Alias + "\"");
}
}
}
Eugene Starkov | email
1 hour, 28 mins since original post
Thank You for response.
Rex
1 day, 11 hours since original post
This topic is closed