samedi 28 mars 2015

C# moving a datetimepicker from a winform to another

I made a program that use a dataset and it makes 3 reports, the things is it sets from 2 datetimepicker (start and end of the period)


but they are in a FORM and I separated each report by a button so each report appear in a different window. and the window loads, but I don't know how I can pass the datetimepickers, from the first FORM to the other 3 FORMS (each window with a different report)



public partial class GenerarIndicadores : Form
{
unyrepDataSetTableAdapters.cargadatosTableAdapter ta_cargadatos;
public GenerarIndicadores()
{
InitializeComponent();
ta_cargadatos = new unyrepDataSetTableAdapters.cargadatosTableAdapter();
int total = ta_cargadatos.GetData().Count;
dateTimePicker1.MinDate = ta_cargadatos.GetData()[0].fechaInicio;
dateTimePicker2.MinDate = ta_cargadatos.GetData()[0].fechaInicio;
dateTimePicker1.MaxDate = ta_cargadatos.GetData()[total - 1].fechaTermino;
dateTimePicker2.MaxDate = ta_cargadatos.GetData()[total - 1].fechaTermino;
}

public void button1_Click(object sender, EventArgs e)
{
new GenerarIndicadorGrupo().ShowDialog();
this.aux_view5TableAdapter.FillTest(this.unyrepDataSet.aux_view5, dateTimePicker1.Value, dateTimePicker2.Value);

}
private void button2_Click(object sender, EventArgs e)
{
new GenerarIndicadorProveedor().ShowDialog();
this.aux_view5TableAdapter.FillTest(this.unyrepDataSet.aux_view5, dateTimePicker1.Value, dateTimePicker2.Value);

}

private void button3_Click(object sender, EventArgs e)
{
new GenerarIndicadorObras().ShowDialog();
this.aux_view5TableAdapter.FillTest(this.unyrepDataSet.aux_view5, dateTimePicker1.Value, dateTimePicker2.Value);

}


I don't know how I can pass the dateTimePickers to the others winforms so the reports can get the info perfectly.


Aucun commentaire:

Enregistrer un commentaire