Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i click the save button record inserted, then the textbox values want to clear.

how can i do using csharp.
C#
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.
Posted
Updated 21-Feb-13 0:43am
v2
Comments
Karthik Harve 21-Feb-13 6:43am    
[Edit] pre tags added.
boogac 21-Feb-13 6:55am    
http://stackoverflow.com/questions/2727417/how-to-use-foreach-loop-to-edit-textboxes

maybe it helps
Naveen.Sanagasetti 21-Feb-13 7:11am    
After insert data you want to clear your textbox values.... right....?

use like this txtname.clear();
Sandeep Mewara 21-Feb-13 11:04am    
You want to clear textbox or it gets cleared?

1 solution

if you are asking for "How to clear TextBox After Insertion Of Data?" then
you can follow the code below:
C#
MessageBox.Show("Records inserted successfully", "Inserted", MessageBoxButtons.OK, MessageBoxIcon.Information);
Textbox.clear(); // this clears the text box after the messageBox is shown.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900