Textbox on enter Pop up a new form or new window
Hi all i need a help i.e if i enter some thing like 1 in my text box i would like to pop up or show a window on the form how can i do this.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 28, 2010, 3:38 PM EDT
private void tmpform1_FormClosed(object sender, FormClosedEventArgs e)
{
if (PageCount > 0)
{
tmpform1 frm = new tmpform1();
frm.PageCount = PageCount;
frm.Show();
}
}
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 26, 2010, 4:03 AM EDT
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 27, 2010, 6:32 PM EDT
Note: Validate the textbox value whether it's an integer or not
private void tbPageSize_TextChanged(object sender, EventArgs e)
{
//Validate the text box value for integer
for (int i = 0; i < Convert.ToInt32(tbPageSize.Text); i++)
{
Form4 frm4 = new Form4();
frm4.Show();
}
}
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 27, 2010, 8:43 PM EDT
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 27, 2010, 9:33 PM EDT
Parent window code:
private void tbPageSize_TextChanged(object sender, EventArgs e)
{
//for (int i = 0; i < Convert.ToInt32(tbPageSize.Text); i++)
//{
Form4 frm4 = new Form4();
frm4.PageCount = 2;
frm4.Show();
//}
}
New window code:
private void Form4_Load(object sender, EventArgs e)
{
PageCount = PageCount - 1;
}
private void Form4_FormClosed(object sender, FormClosedEventArgs e)
{
if (PageCount > 0)
{
Form4 frm4 = new Form4();
frm4.Show();
}
}
public int PageCount
{
get;
set;
}
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 27, 2010, 10:02 PM EDT
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 27, 2010, 10:06 PM EDT
frm4.PageCount = Convert.ToInt32(txtPageCount.Text);
If u want to open the window after leaving the textbox, pls use the same code in that event. (Have to use the same code only in ur required event)
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 27, 2010, 10:10 PM EDT
in the page that we are wishing to transfer
public int PageCOunt
{
get;
set;
}
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 27, 2010, 10:19 PM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 27, 2010, 10:48 PM EDT
'ACHWinapp1.tmpform1.PageCount.get' must declare a body because it is not marked abstract or extern
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 27, 2010, 11:07 PM EDT
private int _pagecount;
public int PageCount
{
get
{
return _pagecount;
}
set
{
_pagecount = value;
}
}
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 27, 2010, 11:09 PM EDT
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 27, 2010, 11:26 PM EDT
from the first form did u set the PageCount like this.
2ndForm frm = new 2ndForm();
frm.PageCount = this.txtPageCount.Text;
frm.Show();
Still u r getting error, pls attach ur code.
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 27, 2010, 11:30 PM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 27, 2010, 11:35 PM EDT
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 27, 2010, 11:38 PM EDT
tmpform1 frm = new tmpform1();
instead of
Form frm = new tmpform1();
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 28, 2010, 12:24 AM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 28, 2010, 12:27 AM EDT
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 28, 2010, 2:10 AM EDT
f.PageCount = Convert.ToInt32(textBox4.Text);
not hard coded with 2..
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 28, 2010, 2:13 AM EDT
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 28, 2010, 4:04 AM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 28, 2010, 4:10 AM EDT
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 28, 2010, 8:22 PM EDT
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 28, 2010, 8:28 PM EDT
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
Dorababu MekaRank #457 · 5.5K reputationPosted Jun 28, 2010, 8:31 PM EDT
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 28, 2010, 9:03 PM EDT