Solved

.Text versus .Value Properties in control

Posted on 2014-02-28
5
212 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 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

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 article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

809 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