How can i pass this method from another form to other
public class arka_data
{
public int NR { get; set; }
public int BARKODI { get; set; }
public string EMERTIMI { get; set; }
public int SASIA {get;set;}
public float CMIMI {get;set;}
public float TVSH { get; set; }
public float TOTAL { get; set; }
public float NENTOTALI { get; set; }
public float ZBRITJA { get; set; }
public float TOTALI { get; set; }
public DateTime KOHA { get; set; }
public string KASIERI { get; set; }
public string KLIENTI { get; set; }
public float VLERAETVSH { get; set; }
public float VLERAPATVSH { get; set; }
public int NRATIKUJVE { get; set; }
public float TOTALIPCS { get; set; }
public float VLERATVSHTOTAL { get; set; }
}
public void mbushe()
{
arka_data dta = new arka_data();
for (int i = 0; i < dataTable.Rows.Count; i++)
{
dta.NR = int.Parse(txtnrfatures.Text);
dta.VLERATVSHTOTAL = float.Parse( textBox1.Text);
dta.BARKODI = int.Parse(dataTable.Rows[i][0].ToString());
dta.EMERTIMI = dataTable.Rows[i][1].ToString();
dta.SASIA = int.Parse(dataTable.Rows[i][2].ToString());
dta.CMIMI = int.Parse(dataTable.Rows[i][3].ToString());
dta.TVSH = int.Parse(dataTable.Rows[i][4].ToString());
dta.NENTOTALI = float.Parse(txttotali.Text);
dta.ZBRITJA = float.Parse(txtzbritja.Text);
dta.TOTALI = float.Parse(totali.Text);
dta.KOHA = DateTime.Now;
dta.KASIERI = lbluser.Text;
dta.KLIENTI = cmbklienti.Text;
dta.VLERAETVSH = float.Parse(dataTable.Rows[i][7].ToString());
dta.VLERAPATVSH = float.Parse(dataTable.Rows[i][6].ToString());
dta.NRATIKUJVE = int.Parse(lblnumri.Text);
dta.TOTALIPCS = float.Parse(dataTable.Rows[i][5].ToString());
}
The idea it that this class handle the data from form one , and use it(insert it into sql) on form two . How should I pass the object in another form, or how should I refer it. Also another question is the class populated correctly (from : textbox, labels and datagridview ). The method mbushe collects data , and this data should be passed one frm2. I created the method on frm1 , but don't have any clue how to cont. on. I tried Arka. Mbushe but getting this error ' is a 'method', which is not valid in the given context'The idea is that during the insertion of data on frm2 I use this data like this
cmd.Parameters.Add(new SqlParameter("@nrfatures", mbushe.NR);
But mu question is how to get this data on frm2 and use this data during the insertion process.