473,671 Members | 2,570 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 1397
AngryWhiteBoy <An***********@ discussions.mic rosoft.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.co m>
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

"AngryWhite Boy" <An***********@ discussions.mic rosoft.com> wrote in message
news:D8******** *************** ***********@mic rosoft.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

"AngryWhite Boy" <An***********@ discussions.mic rosoft.com> wrote in message
news:D8******** *************** ***********@mic rosoft.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
"AngryWhite Boy" <An***********@ discussions.mic rosoft.com> wrote in message
news:D8******** *************** ***********@mic rosoft.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
2451
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, PHProjekt and others...But these 3 CMS were "unable to connect to MYSQL". Sure I looked and read all the docs & install files...I'm lost here - if anyone has used these or other CMS-e-Learning type tools - please let me know. I need to create an...
2
3466
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 and learn how/why they designed it they way they did. Any suggestions?
29
3489
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 have noticed small differnces in the books such as,int main(),main(void),fprintf,and others,just wondering if these older books are still worth trying to learn from as Im on a very tight budget and can`t really afford any thing else,or are they...
1
9625
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 and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
26
2960
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 already knows java very well. And what is the best way to learn C, books, tutorials, or what? Thanks, any response would be great.
7
2381
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 does what I need. I've even tried writing a port forwarder in Java and found problems that nobody seems to have the answer to in forums. I need to make it work essentially the same on both Windows and Linux. There is one program, in C, that...
1
1488
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 completed training for .NET in Chicago through a mentored learning program that personally helped me to tackle that same issue. Though the mentored learning training allows complete interaction with classroom version labs and interaction with an on...
5
1768
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 with my own ground-up projects as well as some work with PRADO (http://pradosoft.com) I've dabbled with a number of languages in the past, Python being no exception, but always ended up coming back to PHP due to being comfortable with it. Python...
16
1752
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? I mean, sure, there's value in learning anything at any time, but for something like a programming language, I can't help but feel that I will be mostly unable to use what I learn simply because I have no reason to use it. The *process* of...
0
8485
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8403
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8828
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8677
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6238
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4227
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4417
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.