Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    Apr 2007
    Messaggi
    3

    Preselezione del campo nel form

    Ciao, scusate ma sono un principiante di vb6 (meglio tardi che mai eheh)

    Ho necessità di gestire dei campi che quando vengono cliccati devono presentare il contenuto già selezionato per essere quindi pronti ad un'eventuale sostituzione.

    Ho cercato tutta mattina qualche riferimento su internet in vari forum ma nisba.
    Qualcuno mi può aiutare?

    Grazie

  2. #2
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    SelStart, SelText ... studia queste proprieta' e quelle collegate ...

  3. #3
    Utente di HTML.it
    Registrato dal
    Apr 2007
    Messaggi
    3
    Avevo il sospetto su quelle funzioni ma non ero riuscito a venire a capo di niente. Comunque grazie al tuo consiglio ci riprovo con più passione.
    Grazie

  4. #4
    Utente di HTML.it
    Registrato dal
    Apr 2007
    Messaggi
    3
    Seguendo il tuo consiglio ci sono riuscito!
    Grazie Oregon

    In caso servisse ad altri vi posto l'esempio che ho trovato:

    You can select all text in a Text Box by setting SelStart to 0 and SelLength to the length of the text. Here's a short procedure that does this:

    Sub SelectAllText(tb As TextBox)

    tb.SelStart = 0
    tb.SelLength = Len(tb.Text)

    End Sub

    Then, for each Text Box that you want to behave this way, call the procedure from the GotFocus event procedure, passing the name of the Text Box as the argument:

    Private Sub Text1_GotFocus()

    SelectAllText Text1

    End Sub

    This works when the Text Box gets the focus either by tabbing or by a mouse click.


Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.