Ron,
The reason there is a ToString() method for a property is because all object
(they inherit from system.object) implement method called ToString(). So
even the simplest object has a ToString() method.
It can be overridden. For example, suppose you created a Customer class, and
you wanted ToString() to return a nicely formatted string, maybe first_name,
last_name or something like that, you could override ToString() in your
class and when someone used your customer class they could call tostring()
with your overridden version.
ex:
Customer cust = new Customer("Fred", "Flintstone", "03/02/1990");
MessageBox.Show ("The Customers name is " + cust.ToString());
hope that helps,
Sincerely,
John Scalco
"RonG" <an*******@discussions.microsoft.com> wrote in message
news:E5**********************************@microsof t.com...
This might seem like a stupid question but I'd really appreciate an
answer.
TextBox.Text is property yet it has a ToString() method. In other words, i
can type in textBox1.Text.ToString() and it returns the Text property.
How can a property have a method?
Why doesn't this show up in the documentation?
Can it be overridden?