Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged MajusculeAuDebut(sender) End Sub Private Sub MajusculeAuDebut(ByVal monTextBox As TextBox) With monTextBox 'Mémoriser la portion sélectionnée dans le Textbox Dim selectionDebut As Integer = .SelectionStart Dim selectionLongueur As Integer = .SelectionLength 'Mettre la première lettre en majuscule et les autres (s'il y en a d'autres) en minuscule If .Text.Length = 1 Then .Text = .Text.Substring(0, 1).ToUpper ElseIf .Text.Length > 1 Then .Text = .Text.Substring(0, 1).ToUpper & .Text.Substring(1).ToLower End If .SelectionStart = selectionDebut .SelectionLength = selectionLongueur End With End Sub
TextBox1.Text = TextBox1.Text.Substring(0, 1).ToUpper() & _ TextBox1.Text.Substring(1).ToString
Char.ToUpper(TextBox1.Text.Chars(0)) + TextBox1.Text.Substring(1, TextBox1.Text.Length - 1)
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionTextBox1.Text = (TextBox1.Text.Substring(0, 1).ToUpper) & TextBox1.Text.Substring(1)
il a affiché l'erreur : "L'index se trouve en dehors des limites du tableau."
je sais pas quel index?
TextBox1.Text = TextBox1.Text.Substring(0, 1).ToUpper() & TextBox1.Text.Substring(1, ((TextBox1.Text.Length) - 1)).ToString
textbox1.text.substring(1)équivalent à
TextBox1.Text.Substring(1,((TextBox1.Text.Length) - 1))
oui vous pouvez me dire dans quel Événement ça va marcher ce code :