Ciao a tutti,

ho un problema nella formattazione di una textbox. Io vorrei che mi aggiungesse automaticamente le barre quando inserisco una data. Vi faccio un esempio: se io voglio inserire ad esempio 01/01/2000 le barre le devo mettere io manualmente, mentre vorrei che fosse una cosa automatica.
Girovagando su google ho trovato questo codice:

codice:
Public Function TextBoxDateFormat(ByVal DAscii As Integer, ByVal txtData As TextBox)
        'Set error trapping on
        On Error GoTo ErrorHandler

        'Inserts '/' into date
        TextBoxDateFormat = DAscii

        'Check code
        If IsNumeric(Chr(DAscii)) Then

            'Format
            If ((Len(txtData .Text) = 2) Or (Len(txtData .Text) = 5)) And (IsNumeric(Chr(DAscii))) Then

                'Add a /
                DTBox.Text = DTBox.Text + "/"
                txtData.SelectionStart = Len(dtbox.Text)

            ElseIf Len(DTBox.Text) = 7 Then

                'Format
                dtbox.Text = Format(txtData + Chr(DAscii), "dd/mm/yyyy")
                TextBoxDateFormat = 0
                txtData.SelectionStart = 10
            End If

        ElseIf DAscii <> 8 Then

            'Do not allow the keystroke
            TextBoxDateFormat = 0
        End If

        'Exit
        Exit Function

ErrorHandler:

        'Process error
        'WriteToErrorLog "ModHelperRoutines", "TextBoxDateFormat", Err.Number, Err.Description
        Resume Next

    End Function
però mi da errore su questa istruzione:

codice:
txtData + Chr(DAscii)
dicendomi che l'operatore + non è definito per i tipi 'system.windows.forms.textbox' e 'char'

Qual'è quindi l'errore che mi trovo a dover fronteggiare?