GST Billing Software

header image

Load a form with a Particular Record

Erachana Line

51. How to load a form with a particular record? (e.g. - when a row on DataGrid is double clicked, the respective data loads in the respective form)

In this scenario, we are loading a form based on the records of another form. This scenario occurs when we need to load the Customer Bill form from Bill Search Form, for an example.

try {

if(dgrData.DataSource != null && dgrData.SelectedRows.Count > 0)


int row_id = dgrData.CurrentCell.RowIndex;

int inv_id = TypeConverter.ConvertToInt(dgrData.Rows[row_id].Cells[dgrDataColumnBillID.Name].Value);

if (inv_id > 0)


string frmName = TypeConverter.ConvertToInt(this.Value) == 1 ? "Bill_Billdetails" : "PurchaseBill_Billdetails";

Form frm = ControlAdapter.CreateForm(frmName);

frm.SetPropertyValue("Value", this.Value);

frm.SetPropertyValue("gId", inv_id);




} catch (Exception exc) {

MessageBox.Show("Unexpected error occured!" + Environment.NewLine + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);


Note : These functions can be associated to events like CellDoubleClick or any ButtonClick