Click here to Skip to main content
Rate this: bad
good
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
Edited 21-Feb-13 0:43am
v2
Comments
Karthik Harve at 21-Feb-13 6:43am
   
[Edit] pre tags added.
boogac at 21-Feb-13 6:55am
   
http://stackoverflow.com/questions/2727417/how-to-use-foreach-loop-to-edit-textboxes
 
maybe it helps
N@veen.S at 21-Feb-13 7:11am
   
After insert data you want to clear your textbox values.... right....?
 
use like this txtname.clear();
Sandeep Mewara at 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
0 OriginalGriff 310
1 Sergey Alexandrovich Kryukov 176
2 PhilLenoir 164
3 Richard MacCutchan 160
4 Sharmanuj 156
0 Sergey Alexandrovich Kryukov 6,081
1 OriginalGriff 5,115
2 CPallini 2,473
3 Richard MacCutchan 1,597
4 Abhinav S 1,505


Advertise | Privacy | Mobile
Web04 | 2.8.140814.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2014
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