i have two textboxes.
txtHostName and txtHotTitle
when the user types in the txtHostName it automatically set the txtHostTitle
= txtHostName
until now it's ok..
now, i want if the user changed the value in txtHostTitle using the keyboard
or the mouse shortcuts (delete, cut, etc) which means i f the use chaned the
value in txtHostTitle in anyway then it should not update the txtHostTitle =
txtHostName
I have created a variable called host_titel_changed which is initially false
but i want to know how can i make it true when detecting any changes in the
txtHostTitle
> i have two textboxes.
>
[quoted text clipped - 13 lines]
> but i want to know how can i make it true when detecting any changes in the
> txtHostTitle
Hi Jassim,
You can do this with DataBinding,
Have txtHostName bind to a property, for instance "Name";
Have txtHostTitle bind to another property, for instance "Title";
In Title's getter, check your flag, if set, read it's own value, otherwise, read Name
private string _name;
public string Name
{
get{ return _Name; }
set{ _name = value; }
}
private string _title;
bool host_title_changed;
public string Title
{
get
{
if(host_title_changed)
return _title;
else
return Name;
}
set
{
_title = value;
host_title_changed = true;
}
}

Signature
Happy coding!
Morten Wennevik [C# MVP]