CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    How to remove a selected character from the textbox?

    I tried SendKeys "{del}", it works but it deletes something that needs to be remained, is there any other way to remove character?

    Programs and requests for them for FREE.
    http://falstok.fly.to

  2. #2
    Join Date
    Feb 2000
    Location
    Belgium
    Posts
    27

    Re: How to remove a selected character from the textbox?

    Maybe this isn't what you mean, but why don't you try something like this :

    Private Sub Command1_Click()
    Dim txt As String
    With Text1
    txt = ""
    txt = Mid(.Text, 1, .SelStart)
    txt = txt & Mid(.Text, .SelStart + .SelLength + 1, Len(.Text) - (.SelStart + .SelLength))
    .Text = txt
    End With
    End Sub

    SecretHell
    If you ain't makin' waves, you ain't kickin' hard enough



  3. #3
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: How to remove a selected character from the textbox?

    If you have a normal textbox (Text1) and a button (Command1) and the text is 'Chris' with the 'i' selected, try :


    private Sub Command1_Click()
    '
    Text1.SelText = ""
    '
    End Sub





    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured