Forms are basically classes where you can put variables to. So you can do something like the one below on your destination form
Suppose you have this class that you want to pass from your source to destination
public class Product
{
public Product() { }
public int ProductID { get; set; }
public string ProductName { get; set; }
public double Price { get; set; }
}
On your destination form, declare the class that will contain the passed object
public partial class Form2 : Form
{
public string val;
public Product product;
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
}
}
And then on your source form, you put values on the variables and on the object like below.
Form2 frm2 = new Form2();
var product = new Product();
product.ProductID = 12345;
product.ProductName = "";
product.Price = 12.0;
frm2.val = "Test";
frm2.product = product;
frm2.Show();
OP wrote:
how i do define my data type or object ?
Not sure what you mean by that, but if you mean passing your objects from one form to another, yes it is possible and the process is the same with the one above.
Edit: I have added a Product class that will be passed from source to destination. Hope you find it useful.