.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!



Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Bind The Value of texboxes of one form to another

Posted By: Aamrapali Tamgadge     Posted Date: December 29, 2012    Points:5   Category :C#
Hello i have 2 forms form1 and form2
in form 1 m having datagridview
and in form 2 m having my form with texboxes
i want to add that texboxes value to datagridview of form one when user click add button of form 1.

i have done the following code but its not working.pls give me any suggetion

private void button1_Click(object sender, EventArgs e)
{
try
{
if (textBox5.Text != "")
{
DataTable dt4 = new DataTable();
DataRow dr;
dt4.Columns.Add("ICode");
dt4.Columns.Add("IName");
dt4.Columns.Add("Model");

dr = dt4.NewRow();
dr["ICode"] = textBox1.Text;
dr["IName"] = textBox2.Text;
dr["Model"] = comboBox1.Text;
dt4.Rows.Add(dr);
c.dataGridView2.DataSource = dt4;
// c.ShowDialog();
}
}
catch { }
}

Responses
Author: Narayanan          Accepted Answer   
Posted Date: December 31, 2012     Points: 40   

Hi,
Check this link
http://dotnettechrocks.blogspot.in/

Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
Author: Amit Mehra          Accepted Answer   
Posted Date: December 31, 2012     Points: 40   

Hi,

By seeing your code it seems like you are trying to capture text box value to data table, If than you have to call

dt4.Rows.Add(dr);
dt4.Acceptchanges();


to make changes effective to DataTable.

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: Aamrapali Tamgadge             
Posted Date: January 02, 2013     Points: 20   

Thank u Narayanan and amit sir.I Got My Solutions.

Software Programmer At OTIS ISRC


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend