Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
| Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 21st, 2005, 06:39 AM
Authorized User
Join Date: Mar 2005
Location: , , India.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to pritz Send a message via Yahoo to pritz
Default swapping characters in a string

hi all,
thanks for solving my query and this group has really some gr8 person.
i have a query for u that if suppose 1,000 is a value now i would like to swap , with 0 on pressin next 0 in the text box.
10,000---this should be the result.

can anyone plz

  #2 (permalink)  
Old August 22nd, 2005, 12:19 PM
Friend of Wrox
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts

It is not that easy.
This works (for integers), but I do not like programs that automatically change the user's input, it can be annoyoing. Let me know if this is ok for you

Option Explicit

Private Sub Text1_Change()
    On Error GoTo errsub
    Dim d As Long
    d = Text1.Text
    Dim c As Long
    c = Text1.SelStart
    Dim s As String
    s = FormatNumber(d, 0, , , vbTrue)
    Text1.Text = s
    If Len(s) > Text1.Text Then
        Text1.SelStart = c
        Text1.SelStart = c + 1
    End If

End Sub

Similar Threads
Thread Thread Starter Forum Replies Last Post
Transform String, Removing Characters. v01 XSLT 3 November 21st, 2008 01:58 PM
Replacing multiple characters in a string philboparker BOOK: XSLT Programmer's Reference, 2nd Edition 0 May 20th, 2008 04:38 PM
Replacing characters in a string semilemon C# 2005 2 June 16th, 2006 11:31 PM
How to eliminate special characters from string dadahonde VB How-To 2 March 11th, 2005 05:14 AM
JSP string find characters ndanger J2EE 2 November 24th, 2004 09:52 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.