当我单击插入的保存按钮记录时,文本框值将变得清晰 [英] when i click the save button record inserted then the textbox values get clear

查看:78
本文介绍了当我单击插入的保存按钮记录时,文本框值将变得清晰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点击插入的保存按钮记录时,文本框值想要清除。



如何使用csharp。

 尝试 
{
sql = 插入Tb_common_Holidays([名称],[日],[类型],[有效]) + values(' + cb_Faculty_Code.Text + ' ,' + cb_daysweek.Text + ','F','A');

GFun.InsertAccessData(sql);
MessageBox.Show( 记录插入成功 已插入,MessageBoxButtons.OK,MessageBoxIcon.Information);

GFun.OleDbCon.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), 错误,MessageBoxButtons.OK,MessageBoxIcon.Error);
}





这是上面的代码,用于将数据保存到它正在运行的数据库中。



然后在运行模式下键入文本框中的数据,然后单击保存按钮,文本框值清除。



我怎么能用csharp。



请帮帮我。



注意它是windows申请。



问候

Narasiamn P.

解决方案

如果你是询问如何在插入数据后清除TextBox?然后

你可以按照下面的代码:

 MessageBox.Show( 成功插入记录 已插入,MessageBoxButtons.OK,MessageBoxIcon.Information); 
Textbox.clear(); // 这会在显示messageBox后清除文本框。


when i click the save button record inserted, then the textbox values want to clear.

how can i do using csharp.

try
{
    sql = "insert into Tb_common_Holidays ([Name],[Day],[Type],[Active]) " + "values('" + cb_Faculty_Code.Text + "','" + cb_daysweek.Text + "','F','A')";
    
    GFun.InsertAccessData(sql);
    MessageBox.Show("Records inserted successfully", "Inserted", MessageBoxButtons.OK, MessageBoxIcon.Information);
    
    GFun.OleDbCon.Close();
}
catch (Exception ex)
{
    MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}



this is the above code for saving the data in to the database it is working.

then in the run mode type the data in the textbox and then i click the save button the textbox values gets clear.

for that how can i do using csharp.

please help me.

Note it is windows application.

Regards
Narasiamn P.

解决方案

if you are asking for "How to clear TextBox After Insertion Of Data?" then
you can follow the code below:

MessageBox.Show("Records inserted successfully", "Inserted", MessageBoxButtons.OK, MessageBoxIcon.Information);
Textbox.clear(); // this clears the text box after the messageBox is shown.


这篇关于当我单击插入的保存按钮记录时,文本框值将变得清晰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆