Saturday, 15 September 2012

c# - Pass Value from Form2 ListView to Form1 DataGridView -


itemprop = "text">

I have 2 forms in the C # application, Form 1 contains the main form with the datagrid view; columns are account code, account, amount , The statement can presently enter the user account code manually and can use the SQL query. The account name is populated with relevant title.

Now I am looking for a way for the user who searches for the account code in Form 2, which contains the account code account and the name of the account, after the user doubleclick or press OK button the selected value is form 1 In the active line in the DataGridView active line here is the main concern, because viewing Form 2 will not only be used to record new records, but also to other records Used to update, which also require viewing the values ​​of Form 2 ListviewView.

I know how the value

searching for expert guidance / advice

Ahmed

in Form 2 According to your property, public property can be made and fixed value

  public string SelectedCode {get; Set; }  

and you can use that public property in Form 1 and for example the set value of the datagrid

  form2 frm2 = new form2 () ; Frm2.ShowDialog (this); DataGridView1 Selected seals [0]. Value = Fm2. Selected;  

No comments:

Post a Comment