Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I created two Forms in the Win form Application.

In the First form I have a One text Box and one Button and in the Second Form I have a Datagridview.
In that Grid I bind some values using Database.

In form one, if I click textbox and press ENTER or any key using KeyDown event then Form2 will display with that values.

For example:
The values are X,Y,Z.
In that Grid I just select the Y and click Enter that Y value is show in that Textbox.


Please Help.

Thanks in Advance.
Posted
Updated 6-Nov-11 21:35pm
v2
Comments
Dalek Dave 7-Nov-11 3:35am    
Edited for Grammar and Syntax.
Sam Path 7-Nov-11 3:51am    
Its ok...
Member 10626628 21-May-14 16:30pm    
Your Solution Sam Path
Member 10626628 21-May-14 16:30pm    
Your Solution ...

http://stackoverflow.com/questions/1559770/send-values-from-one-form-to-another-form-in-c-sharp-winforms-application[^]

You need to call raise databound event of DataGridView.
But your question was very confusing.

Regards
 
Share this answer
 
Fisrt Using The Enter Code

1) Form Properties = KeyPriview = True
2) Your TextBoex TAB Index Properly For Exmp=1,2,3,4,5,6..etc
3) Your Form Kyedown Event Using

4) if (e.KeyCode == Keys.Escape)
Close();
if (e.KeyCode == Keys.Enter)
SendKeys.Send("{Tab}");

Code Type Here KeyDown Envent Paest

Second Code....
Button Clike Event Second Form Show And Form Load Event Code Type Here

SQLConnection con = new SQLConnection("Your Connection String");
SQLCommond cmd;
SqlDataReder dr;

cmd = new sqlcommond("Select * From YourTableName",con);
DataTable dt=New DataTable();
con.open();
dr=cmd.excuteReader();
dt.load(dr);
DataGrideView.DataSource=dt;
con.close();

I m Zaid Ansari From Bhiwandi
 
Share this answer
 
v2

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