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.
Store the value of the DateTimePicker in a property then get it through the other forms.
form1:
public string dTime{get;set;}
dTime = datetimepicker1.Value.Date;
form2:
public string getDTime{get;set;}
getDtime = form1.dTime;
datetimepicker2.value.Date = getDtime;
PS make sure you initialize form1 to other forms for you to get the value of dTime.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.