Transfer date value from Form1 to class c # windows form .net [closed]

1

I'm working with windows form .net c # but I do not have much practice and would like some help ...

I have a calendar component in a form1 and after running the application, a date is selected which is stored in a var.Até alright. I created a class as shown below: In this class I need to receive the value of the chosen date in form1 and I do not know how to do ...

Form1

private void btnBuscar_Click(object sender, EventArgs e)
{
    if (validaPeriodo() == true)
    {
        btnValidar.Enabled = true;
        btnGerar.Enabled = false;
        btnVisualizarFalha.Enabled = false;

        NewDb openDb = new NewDb();
        DataTable resultado = new DataTable();

        using (MySqlConnection db = openDb.AbrirConexaoMySql())
        {
            try
            {
                db.Open();


                if (CESDI.SelectedTab.Text == "CESDI")
                {
                    MySqlCommand sqlCommand = MamData.MySql.CESDI.SelectCESDI(db, dtaDataInicio.Text, dtaDataFinal.Text);
                    txtNAtos.Text = MamData.MySql.CESDI.SelectAtosCesdi(db, dtaDataInicio.Text, dtaDataFinal.Text);
                    inicializarGrids(sqlCommand, gridCESDI);
                }
            }
        }
    }
}

Class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Drawing;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using MamData;
using System.Net;
using Comunicacao.Dal;

using System.Data;
using System.ComponentModel;
using MySql.Data.MySqlClient;


namespace Comunicacao.XML.CENSEC
{
    public class GeraSEFAZ
    {
        public static string dataInicial;
        public static string dataFinal;

        static public string geraXmlSEFAZ(List<DataGridViewRow> registros)
        {
        }
    }
}
    
asked by anonymous 13.03.2015 / 20:49

1 answer

1

To use date you will have to work with DateTime . I do not see how to work the date in your code just with String.

For example:

DateTime dataInicio = DateTime.Now; //Usando a data atual
    
24.11.2015 / 23:11