473,511 Members | 16,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Learning C# need some help.

I was wondering how I would go about outputting text into a textbox1 as well
as getting data entered into it by the user?

Example:

I ask: Input cash amount:
Then below that
they put in $24.54 hit enter

more or less how to make the textbox act like a console application...
Nov 16 '05 #1
4 1393
AngryWhiteBoy <An***********@discussions.microsoft.com> wrote:
I was wondering how I would go about outputting text into a textbox1 as well
as getting data entered into it by the user?

Example:

I ask: Input cash amount:
Then below that
they put in $24.54 hit enter

more or less how to make the textbox act like a console application...


You can set the Text property just as easily as you can read it.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
I assume this is a windows form application...

You ask "Input cash amount" by placing a label on the form.
You place "Textbox1" on the form.
You place an OK button on the form.
On the form, you find the AcceptButton property and set it to the name of
the OK button.
Put code into the Click event of the OK button to read the Textbox1.Text
property... that will give you the data the user entered.

This is called event-driven programming.

--- Nick

"AngryWhiteBoy" <An***********@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
I was wondering how I would go about outputting text into a textbox1 as well as getting data entered into it by the user?

Example:

I ask: Input cash amount:
Then below that
they put in $24.54 hit enter

more or less how to make the textbox act like a console application...

Nov 16 '05 #3

"AngryWhiteBoy" <An***********@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
I was wondering how I would go about outputting text into a textbox1 as well
as getting data entered into it by the user?

Example:

I ask: Input cash amount:
Then below that
they put in $24.54 hit enter

more or less how to make the textbox act like a console application...


setting:
textbox1.Text = "$24.54"

retrieving:
Dim myValue As String = textbox1.Text

Mythran
Nov 16 '05 #4
Assuming youre using C#, you can use many visual basic.net examples

Make a new windows form

make 2 text boxes from the tools thing on the left side

make 1 button also

Now view the code and just after the CLASS definition, make your variable
str a public variable like this:

partial class Form1 : Form

{

public string str;

This way your program can operate on the same variable, giving it a larger
SCOPE
double click on the first textbox
inside the brackets, type
str = textBox1.Text;

now double click on the button, inside those brackets, type

textBox2.Text = str;

Id suggest trying to operate on button clicks instead of using the
enter/return button for now, because you have to have the focus on your
textbox for the return button to act as a click for that box
"AngryWhiteBoy" <An***********@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
I was wondering how I would go about outputting text into a textbox1 as well as getting data entered into it by the user?

Example:

I ask: Input cash amount:
Then below that
they put in $24.54 hit enter

more or less how to make the textbox act like a console application...

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2423
by: Sean | last post by:
While checking out opensourcecms.com - I found only 3 CMS - e-Learning tools. Are there more and has anybody used the 3.(Claroline - Moodle - Segue) I have has much success with PHPNUKE, Guppy,...
2
3452
by: ggg | last post by:
I'm looking for a complete project/application done with heavy use of of object-oriented programming & design. Preferably something well documented and/or commented so that I can pick it apart...
29
3456
by: Jhon smith | last post by:
Hi,all,I was just wondering if I am likly to have any problems trying to learn C from older books,I have some from the late 80`s,mid/late 90`s. I am using Dev-C++ on the pc windows platform,But I...
1
9587
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
26
2931
by: mfasoccer | last post by:
I am sorry if this is an inappropriate place to put this post, if so please delete it. I am wondering about a few things. Do you guys recommend learning C as a second language, as someone who...
7
2362
by: Hal Vaughan | last post by:
I have a problem with port forwarding and I have been working on it for over 2 weeks with no luck. I have found C programs that almost work and Java programs that almost work, but nothing that...
1
1485
by: whosesocks | last post by:
I discovered that many of my very busy colleagues are having an extremely difficult time pulling themselves away to take vital training when it requires being away for consecutive days. I just...
5
1759
by: romiro | last post by:
Hi all, I'm a PHP5 developer looking to "broaden my horizons" so to speak by learning a new language. I emphasize the 5 in PHP since I have fully engrossed myself in the full OOP of version 5...
16
1739
by: John Salerno | last post by:
Just something that crosses my mind every time I delve into "Learning Python" each night. Does anyone see any value in learning Python when you don't need to for school, work, or any other reason?...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7423
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.