Solved

Clearing a Textbox

Posted on 2013-06-28
2
315 Views
Last Modified: 2013-06-28
if I had a text box named txtAnswer I could clear it with txtAnswer.Clear() or txtAnswer.Text = String.Empty()  Using the Clear() method would keep this statement shorter.  Is there any other reason why you would chose one method over the other?
0
Comment
Question by:M1Bill72
2 Comments
 
LVL 21

Accepted Solution

by:
Tapan Pattanaik earned 110 total points
ID: 39286219
Hi  M1Bill72,

 I would choose the TextBox.Clear() method, because it is logically better to clear a value, rather than re-assigning it with another value. But I wanted to do a little test...

for more details please check this link.

http://www.experts-exchange.com/Microsoft/Development/Microsoft_Programming/WPF_and_Silverlight/A_10775-WPF-TextBox-Text-String-Empty-vs-TextBox-Clear-vs-TextBox-ClearValue-vs-TextBox-SetValue.html
0
 
LVL 13

Expert Comment

by:jonnidip
ID: 39286285
Nice to see my article in a solution!
In short: if you only need to clear text, then the best is to assign String.Empty.

Regards.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
import issue in bit values 3 44
Image(2) 3 26
How to Get total minutes between two hours 4 27
XML & .net 5 20
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now