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
Prime b
NA
810
346.1k
Question about keyPress
Apr 2 2012 8:42 PM
This is the program i made, my question is for the highlighted parts
Is there any way to get it display automatically? For example when you double click textbox it will create a method ===>>> private void textBox1_TextChanged(object sender, EventArgs e)
But what about KeyPress? Is there any way to get that method? Do i have to maybe triple click it? I had to write it out my self, so that's what I am wondering.
Also
System.Windows.Forms.KeyPressEventArgs
is the same thing as
KeyPressEventArgs?
private void
textBox1_KeyPress(object sender,System.Windows.Forms.KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !(Char.IsControl(e.KeyChar)))
{
if(!(e.KeyChar.ToString() == ",") && (textBox1.Text.IndexOf(",") == -1))
e.Handled = true;
}
}
private void
textBox2_KeyPress(object sender,System.Windows.Forms.KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !(Char.IsControl(e.KeyChar)))
{
if (!(e.KeyChar.ToString() == ",") && (textBox1.Text.IndexOf(",") == -1))
e.Handled = true;
}
}
private void button1_Click(object sender, EventArgs e)
{
double rate;
double usd;
double rub;
label4.Text = "";
try
{
usd = System.Convert.ToDouble(textBox1.Text);
rate = System.Convert.ToDouble(textBox2.Text);
rub = usd * rate;
label4.Text = usd.ToString("N") + " USD = " + rub.ToString("C");
}
catch
{
if ((textBox1.Text == "") || (textBox2.Text == ""))
{
MessageBox.Show("Error in output. \n" + "You must enter data in both text boxes.", "Converter", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Error in output. \n" + "Data is in the wrong format in one of the text boxes.", "Converter", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
Reply
Answers (
2
)
update unable to find tablemapping 'table' or datatable 'table'.
How do I divide this function of a linked list for 2 functions One to put data and one to print them???