esquima Posted December 4, 2007 at 06:52 PM Report Share #152288 Posted December 4, 2007 at 06:52 PM alguem pode testar esta função e tentar me ajudar como e que faço uma alteraçao nela o problema e que ela mete a 1ªletra maiscula, so que se eu quiser alterar algumas letras no meio de uma palavar ela so me altera 1 e mete logo o cursor no fim da palavra.. vou deixar aqui o codigo..fica dentro do evento textchanged de uma text box 'mete a primeira letra maiuscula na 1ª palavra Dim txb As New TextBox txb = sender If Not String.IsNullOrEmpty(txb.Text.Trim) Then Dim s As String = "" s = Char.ToUpper(txb.Text.Chars(0)) txb.Text = s + txb.Text.Substring(1) txb.Select(txb.TextLength, 1) End If Link to comment Share on other sites More sharing options...
Joca Posted December 4, 2007 at 10:11 PM Report Share #152351 Posted December 4, 2007 at 10:11 PM Vê se serve (só acrescentei "ToString" e modifiquei o cabeçalho do "If..End if") : 'mete a primeira letra maiuscula na 1ª palavra Dim txb As New TextBox txb = sender If txb.Text <> "" Then Dim s As String = "" s = Char.ToUpper(txb.Text.Chars(0)) txb.Text = s + txb.Text.Substring(1).ToString txb.Select(txb.TextLength, 1) End If Link to comment Share on other sites More sharing options...
esquima Posted December 4, 2007 at 10:18 PM Author Report Share #152352 Posted December 4, 2007 at 10:18 PM nao da..continua a acrescentar o cursor no fim das palavras...so da para alterar 1 letra no meio de uma palavra, dps mete logo o cursor no fim Link to comment Share on other sites More sharing options...
Tiago Salgado Posted December 5, 2007 at 09:15 AM Report Share #152391 Posted December 5, 2007 at 09:15 AM esquima, experimenta guardar a posição do cursor antes de executares esse código, e dps voltas a posiciona-lo nessa posição guardada. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now