Click here to Skip to main content
15,913,944 members
Home / Discussions / C#
   

C#

 
GeneralRe: coding guidelines question Pin
Luc Pattyn30-Jul-07 3:27
sitebuilderLuc Pattyn30-Jul-07 3:27 
AnswerRe: coding guidelines question Pin
DavidNohejl28-Jul-07 3:43
DavidNohejl28-Jul-07 3:43 
Questioncrystal reports Pin
monuSaini28-Jul-07 0:20
monuSaini28-Jul-07 0:20 
AnswerRe: crystal reports Pin
Rupesh Kumar Swami28-Jul-07 1:44
Rupesh Kumar Swami28-Jul-07 1:44 
AnswerRe: crystal reports Pin
prasanna muthuramalingam28-Jul-07 3:22
prasanna muthuramalingam28-Jul-07 3:22 
GeneralRe: crystal reports Pin
monuSaini29-Jul-07 20:48
monuSaini29-Jul-07 20:48 
QuestionXML Root tag Pin
M. J. Jaya Chitra27-Jul-07 23:13
M. J. Jaya Chitra27-Jul-07 23:13 
Questiondelete a control containing label and textbox while assigning text at runtime Pin
trulyyy27-Jul-07 22:57
trulyyy27-Jul-07 22:57 
i have designed a code that will add a control on panel of the form and then if i want to delete it it will delete the code by pressing delete key.

the control code is as follows


public partial class NO : UserControl
{
public NO()
{
InitializeComponent();
}

private void NO_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Point[] points = { new Point(0, 42), new Point(15, 42), new Point(15, 25), new Point(15, 63), new Point(30, 25), new Point(30, 63), new Point(30, 42), new Point(47, 42) };
g.DrawLines(Pens.Black, points);
g.Dispose();
}

private void txt_no_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
lbl_no.Text = txt_no.Text;
lbl_no.Visible = true;
txt_no.Visible = false;
}
}

private void lbl_no_DoubleClick(object sender, EventArgs e)
{
lbl_no.Visible = false;
txt_no.Visible = true;
}
}

while the control is added on the form on a click event

private void NO_Click(object sender, EventArgs e)
{
NO no_obj=new NO();
no_obj.Location = new Point(x, y);
fpanel1.Controls.Add(no_obj);
x += 50;

no_obj.Click += new EventHandler(no_obj_Click);
}

void no_obj_Click(object sender, EventArgs e)
{
c = (NO)sender;
c.KeyDown += new KeyEventHandler(c_KeyDown);
}

void c_KeyDown(object sender, KeyEventArgs e)
{

if (e.KeyCode == Keys.Delete)
{
fpanel1.Controls.Remove(c);
}
}
the code works fine on click event.
my problem is that when i insert any text in text box and then try to delete my control using DELETE key it will not delete it.
plz send some suggestion so that i m able to resolve this problem on keypress event.



AnswerRe: delete a control containing label and textbox while assigning text at runtime Pin
Martin#30-Jul-07 10:38
Martin#30-Jul-07 10:38 
Questioni have design a controle using following code Pin
cuteAisha27-Jul-07 22:56
cuteAisha27-Jul-07 22:56 
AnswerRe: i have design a controle using following code Pin
Guffa27-Jul-07 23:12
Guffa27-Jul-07 23:12 
GeneralRe: i have design a controle using following code Pin
cuteAisha28-Jul-07 1:39
cuteAisha28-Jul-07 1:39 
AnswerRe: i have design a controle using following code Pin
Luc Pattyn28-Jul-07 2:04
sitebuilderLuc Pattyn28-Jul-07 2:04 
Questionapplication connect to sql data base Pin
prasadbuddhika27-Jul-07 22:43
prasadbuddhika27-Jul-07 22:43 
AnswerRe: application connect to sql data base Pin
Colin Angus Mackay27-Jul-07 23:08
Colin Angus Mackay27-Jul-07 23:08 
QuestionRefreshing a Form Pin
sangramkp27-Jul-07 21:46
sangramkp27-Jul-07 21:46 
AnswerRe: Refreshing a Form Pin
ekynox27-Jul-07 21:49
ekynox27-Jul-07 21:49 
GeneralRe: Refreshing a Form Pin
sangramkp27-Jul-07 21:57
sangramkp27-Jul-07 21:57 
GeneralRe: Refreshing a Form Pin
ekynox27-Jul-07 23:17
ekynox27-Jul-07 23:17 
GeneralRe: Refreshing a Form Pin
sangramkp28-Jul-07 0:03
sangramkp28-Jul-07 0:03 
Questionhi friends Pin
Baljit Singh Grewal27-Jul-07 20:58
Baljit Singh Grewal27-Jul-07 20:58 
AnswerRe: hi friends Pin
Christian Graus27-Jul-07 21:31
protectorChristian Graus27-Jul-07 21:31 
AnswerRe: hi friends Pin
Guffa27-Jul-07 21:57
Guffa27-Jul-07 21:57 
Questionselect from DataBase Pin
Thaer Hamael27-Jul-07 18:10
Thaer Hamael27-Jul-07 18:10 
AnswerRe: select from DataBase Pin
Christian Graus27-Jul-07 18:24
protectorChristian Graus27-Jul-07 18:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.