Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i sand data from form 1 datagridview to text box on form 2 by pressing button & search data in datagridview by one text box by just typing some part of string of data then select the data and send to form 2 text box


how can i connect data source to datagridview by command not by property change thnks
Posted
Updated 17-Dec-13 0:29am
v2
Comments
Karthik_Mahalingam 17-Dec-13 6:34am    
what you have tried ?
joginder-banger 17-Dec-13 6:41am    
you can try with the help of Static Keyword. Static keyword across the application you can used Data. Share your coding parts for more information.

Exactly how depends on the relationship between the forms.
See these:
Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
Transferring information between two forms, Part 3: Child to Child[^]

If a form creates an instance of another form, then it is the Parent, and the new form is the Child.
 
Share this answer
 
Comments
TUMAAJKAL 17-Dec-13 12:20pm    
thanks for reply but my Q. is datagridview to form2 textbox transfer i m not avail to select data and print that in textbox from data grid view
Hello TUMAAJKAL,

To Send data from form1 GridView to Textbox on form2 on button click, perform the following step:

1.) In form1, on buttonClick event:
C#
string Name = GridView1.Rows[0].Cells[0].Text;
/* store particular row & column value in Name variable*/
Response.Redirect("Form2.aspx?Name="+ Name );
/*Send Name variable to form2*/

2.) Now get Name variable to Textbox on form2. In Form2 Page_Load() event write following code:
C#
TextBox1.Text = Request.QueryString["Name"];
/*store Name variable value to TextBox1*/

i hope you will get your right result from this answer, and dont forget to accept this solution.... thank you.
 
Share this answer
 
Comments
TUMAAJKAL 17-Dec-13 12:17pm    
please make ur example more clear because

string Name = GridView1.Rows[0].Cells[0].Text;

in vs 2010 .text not showing then i tried

string Name = Convert.ToString(dataGridView1.Rows[0].Cells[0]);
this is also not working and button on data grid view or on form
what is respose.redirect("form2.aspx?name"+name)
how and where to write this code thanks
JR009 17-Dec-13 22:50pm    
Hi friend,

1. write string Name = GridView1.Rows[0].Cells[0].Text; in button click eventm and there should be .text property in button click event. check your code again because my code works fine in vs 2010.

2. write respose.redirect("form2.aspx?name"+name); in button click event which transfer varible name's value to form2.aspx page.
TUMAAJKAL 19-Dec-13 11:01am    
in place Name = GridView1.Rows[0].Cells[0].Text;
Name = GridView1.Rows[0].Cells[0].ToString();

and this is windows apps where/how i can i find from2.aspx i got form2.cs but not .aspx

i m trying to make an list of items in data grid view in searchable mode then with selection available function for mall apps please help me
To search Data in GridView please refer the following article,

http://www.aspdotnet-suresh.com/2011/12/search-records-in-gridview-and.html[^]

thank you.
 
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