Solved

C# textbox

Posted on 2014-04-11
4
349 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
  • 2
  • 2
4 Comments
 
LVL 62

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 62

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video discusses moving either the default database or any database to a new volume.
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…

708 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

16 Experts available now in Live!

Get 1:1 Help Now