Click here to Skip to main content
12,398,000 members (54,602 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
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.
Posted 21-Feb-13 0:41am
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
N@veen.S 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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100