In my for i have a bounded TextBox (txt_pana_la_data.Text).
I want to compare the txt_pana_la_data.Text with the curent date in the format "dd/MM/yyyy".
I have tryed with this code but is not working if i have for example the txt_pana_la_data.Text = 25/10/2007... what's wrong ?
Code:Private Sub txt_pana_la_data_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_pana_la_data.TextChanged 'Dim data_curenta = Date.Now Dim data_expirarii As Date Dim data_curenta As Date data_curenta = Today Format(data_curenta, "dd/MM/yyyy") data_expirarii = Me.txt_pana_la_data.Text Format(data_expirarii, "dd/MM/yyyy") If data_expirarii < data_curenta Then Me.txt_stare_permis.Text = "Expirat" Me.btn_prelungire.Enabled = True Me.Validate() Me.permis_BindingSource.EndEdit() Me.permis_TableAdapter.Update(Me.permis_DataSet.lista_abonati) Me.permis_BindingSource.Clear() Me.permis_TableAdapter.Fill(Me.permis_DataSet.lista_abonati) Else 'Me.txt_stare_permis.Text = "Activ" End If End Sub




Reply With Quote