Solved

.Text versus .Value Properties in control

Posted on 2014-02-28
5
214 Views
Last Modified: 2014-03-07
What is the basic difference between .Text and .Value properties when creating controls?
0
Comment
Question by:metro156
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 75

Expert Comment

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

Expert Comment

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

Author Comment

by:metro156
ID: 39895482
What controls? Since you mentioned Web controls, Forms controls and user controls,  what is the difference?
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 250 total points
ID: 39895609
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
ID: 39895652
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.Net creating Contact in Outlook 1 55
Exception when using Alea null reference in fsharp.core.dll 3 52
c# DateTime Format validation 4 68
Return array 3 20
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 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