Solved

.Text versus .Value Properties in control

Posted on 2014-02-28
5
209 Views
Last Modified: 2014-03-07
What is the basic difference between .Text and .Value properties when creating controls?
0
Comment
Question by:metro156
5 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
What controls?  Web controls? Forms controls? User controls?
0
 
LVL 11

Expert Comment

by:David Kroll
Comment Utility
Usually text means that it can only contain text, but value can contain numeric data as well.
0
 

Author Comment

by:metro156
Comment Utility
What controls? Since you mentioned Web controls, Forms controls and user controls,  what is the difference?
0
 
LVL 74

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 250 total points
Comment Utility
If you are creating a Windows Forms application, then you have Forms controls. If you are creating an ASP.NET application, then you have web controls. User controls exist in both, and are similar in concept, but different in implementation.

Perhaps I should have stated the question as: What kind of project are you creating?
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 250 total points
Comment Utility
It depends on the control, but basically, the Text is what the user sees on the screen, the Value is what it means to you as a programmer.

Take the DateTimePicker in Windows Forms for instance, and suppose its date is set to New DateTime(2013, 6, 20).

Its Value returns the date in a DateTime structure, for you as a programmer, that is was interests you, because you will get it the same way no matter on which computer the application is running

It Text property however, can change, depending on the Control Paner settings on the computer it is running.

On your computer it can "June 20, 2013"
On another it can end up being "2013-06-20"
On mine, it would return "20 juin 2013"

As a programmer, if I have to deal with the date, I prefer to use Value. But if I have to display it to a user in a MessageBox, I will use Text, to make sure that it displays the same in the message as it does in the DateTimePicker.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
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…

763 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

11 Experts available now in Live!

Get 1:1 Help Now