Lm Martiness

Lm Martiness

  • NA
  • 107
  • 8.2k

Pass object from another form to other c#

May 26 2020 6:48 AM
Hi everyone
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 (fromtextbox, labels and datagridview )

Answers (5)