Solved

.Text versus .Value Properties in control

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

860 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