Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
| FAQ | Members List | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #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

Reply With Quote
  #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
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 01:16 PM.

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