TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mike henderson
NA
1
0
new to c#, how to create a windows forms application "recur"
Jan 14 2009 7:44 AM
hi there. so i'm new to c# and am trying to make a simple "counter" in a windows forums application.
i've created a text box (for input) and a rich text box (for output).
if i press the "1" key in the rich text box i'd like the rich text box to increment it's output.
private void textBox1_TextChanged(object sender, EventArgs e)
{
int one=0;
//while (one<10)
if (textBox1.Text == "1")
{
one = one + 1;
richTextBox1.Text = " " + one;
}
textBox1.Text = "";
}
the problem is if i enable the while loop , the program hangs :( how to i get keep incrementing?
i am c# express on vista. also is there a difference between a windows form application and a windows application?
i'd appreciate any help.
EDIT:
nevermind i figured out the prob. was having trouble with a global variable. heres a working version if anyone wants it.
public partial class Form1 : Form
{
int one = 0;
public Form1()
{
InitializeComponent();
this.textBox1.Focus();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (textBox1.Text == "1")
{
one = one + 1;
richTextBox1.Text = " " + one;
}
textBox1.Text = "";
}
}
Reply
Answers (
2
)
External Application Check
.Net windows application, Presentation layer and Business logic layer