The form gets stuck / stuck when I click the datetimepicker

3

I'm developing an application and I've done 90%, but I'm having a problem with the datetimepicker control.

Normally its format is long, but I had to change to 'time' and enabled ShowUpDown as true .

When I click on the control the form gets stuck and nothing works and does not close.

So I have to close in Windows Task Manager or stop debugging.

How can I resolve this?

It has no associated event, I just in graphical mode, I edit the time of the visitor's exit and for 12:45:00 for example, then I click on the refresh button taking the value of the control through the property nomeObjeto.Value .TimeOfDay; which is the TimeSpan property that I need to store in the database.

The problem is that when I jump in the contour, the other contours do not work only it, nor the update button responds to the click, but the control in question continues allowing change hour, minute and second, it is as if I had to take of the edit mode or stop some terefa that it creates.

Here's my form code, just look at the refresh button method:

using System;
using System.Windows.Forms;
using ObjetoTransferencia.ControleVisitante;
using RegrasDeNegocio.CRUD;

namespace Intragh.Portaria
{
    public partial class FrmControleVisitante : Form
    {
        private readonly ControleVisitanteCRUD _controleVisitanteCrud;
        public FrmControleVisitante()
        {
            InitializeComponent();
            _controleVisitanteCrud = new ControleVisitanteCRUD();
        }

        private void FrmControleVisitante_Load(object sender, EventArgs e)
        {
            controleVisitanteBindingSource.DataSource = _controleVisitanteCrud.GetAll();
        }

        private void btnNovo_Click(object sender, EventArgs e)
        {
            FrmControleVisitanteCadastrar frmControleVisitanteCadastrar = new FrmControleVisitanteCadastrar();
            frmControleVisitanteCadastrar.ShowDialog();
            controleVisitanteBindingSource.DataSource = _controleVisitanteCrud.GetAll();
        }

        private void btnAtualizar_Click(object sender, EventArgs e)
        {
            try
            {
                var controleVisitante = controleVisitanteDataGridView.SelectedRows[0].DataBoundItem as ControleVisitante;

                if (controleVisitante != null)
                {
                    controleVisitante.ControleId = Convert.ToInt32(controleIdTextBox.Text);
                    controleVisitante.HoraSaida = horaEntradaDateTimePicker.Value.TimeOfDay;
                    controleVisitante.Observacao = observacaoTextBox.Text;

                    _controleVisitanteCrud.Atualizar(controleVisitante);
                }
                controleVisitanteBindingSource.DataSource = _controleVisitanteCrud.GetAll();

            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
    }
}
    
asked by anonymous 26.10.2017 / 14:13

0 answers