Solved

C# textbox

Posted on 2014-04-11
4
370 Views
Last Modified: 2014-04-12
Hi guys ,

I would like to know how do I provide from my users to type in the textbox (windows form)...the only I need is to display for them information.
0
Comment
Question by:Moti Mashiah
[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
  • 2
  • 2
4 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 39995613
Once you have placed a TextBox control on the form the user is free to type characters into the TextBox. To programmatically get the data from the TextBox and place it into a variable do the following.

string textFromTextBox = textBoxName.Text;

If you wish to programmatically place text into a TextBox then do the following.

TextBoxName.Text = StringVariableInstance;

I hope that answers your question.
0
 
LVL 1

Author Comment

by:Moti Mashiah
ID: 39996104
Thank you for your answer but what I want to do is to prevent user from typing into the textbox the textbox display data from the database server.
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 39996118
I see. To do that you can use the ReadOnly property which will allow the user to read the information in the text box but will not allow the user to enter data in to the text box.

TextBoxInstance.ReadOnly = true;

Be advised that doing this will cause the characters to be display as a light gray and some people find it difficult to read. You may want to replace the text box control with a label control which will keep the same text color as the rest of the form and still will not allow the user to change the data.
0
 
LVL 1

Author Closing Comment

by:Moti Mashiah
ID: 39996184
excellent thank you
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

627 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