Hi Guys,
I got a form with a datagridview in it as shown in the picture. I my app I use this as dialogue window for tax category selection. The problem is I need to use the same dialogue on different forms. I tried to set public variables to send data between forms. When I double click on datagrid row, form closes and text box in another form gets the data. My issue is every time when I close the form the textbox in different forms changes as the public variables changes. Please see my code.
Is there any way to find from which form the Tax category dialogue form is opened, and to send data to that particular form only? Thanks is advance.
Public Class Tax_cata_selector_frm
Private Sub Tax_cata_selector_frm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Public Property sent_Cat_Id As Integer
Public Property sent_cata_name As String
Public Property sent_SGST_rate As Decimal
Public Property sent_SGST_cess_rate As Decimal
Public Property sent_CGST_rate As Decimal
Public Property sent_CGST_cess_rate As Decimal
Public Property sent_IGST_rate As Decimal
Public Property sent_IGST_cess_rate As Decimal
Private Sub DataGridView1_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellDoubleClick
Dim i, j As Integer
i = DataGridView1.CurrentRow.Index
sent_Cat_Id = Convert.ToInt32(DataGridView1.Item(0, i).Value)
sent_cata_name = Convert.ToString(DataGridView1.Item(1, i).Value)
sent_SGST_rate = Convert.ToDecimal(DataGridView1.Item(2, i).Value)
sent_SGST_cess_rate = Convert.ToDecimal(DataGridView1.Item(3, i).Value)
sent_CGST_rate = Convert.ToDecimal(DataGridView1.Item(4, i).Value)
sent_CGST_cess_rate = Convert.ToDecimal(DataGridView1.Item(5, i).Value)
sent_IGST_rate = Convert.ToDecimal(DataGridView1.Item(6, i).Value)
sent_IGST_cess_rate = Convert.ToDecimal(DataGridView1.Item(7, i).Value)
'this is the first form that gets data when this form is closed
tax_cata_frm.cata_id_txt.Text = sent_Cat_Id
tax_cata_frm.cata_name_txt.Text = sent_cata_name
tax_cata_frm.CGST_rate_NUD.Value = sent_CGST_rate
tax_cata_frm.CGST_cess_rate_NUD.Value = sent_CGST_cess_rate
tax_cata_frm.SGST_rate_NUD.Value = sent_SGST_rate
tax_cata_frm.SGST_cess_rate_NUD.Value = sent_SGST_cess_rate
tax_cata_frm.IGST_rate_NUD.Value = sent_IGST_rate
tax_cata_frm.IGST_cess_rate_NUD.Value = sent_IGST_cess_rate
'this is the second form that gets data when this form is closed
Add_product_frm.Tax_cata_dis_combo.SelectedValue = sent_Cat_Id
Me.Close()
End Sub
End Class