Solved

VB6 - Remove last comma in Textbox

Posted on 2014-02-12
2
288 Views
Last Modified: 2014-02-12
Hi all

I would like to know how i can remove in my Text5 the last comma chowing at the end.

Ex;

If i have the value ; 1,2,3,4,5,6,7,8,

Then, it should remove the last ",".

The final answer would be: 1,2,3,4,5,6,7,8


But if i have the value: 1,2,3,4,5,6,7,8

Then since their is no comma as the last digit in the TextBox, the final answer would stay the same: 1,2,3,4,5,6,7,8

How can i do that?

Thanks
0
Comment
Question by:Wilder1626
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
Comment Utility
This should remove any trailing commas
    Do While Right(Text1.Text, 1) = ","
        Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)
    Loop

Open in new window

0
 
LVL 11

Author Closing Comment

by:Wilder1626
Comment Utility
HI

This is great. Thanks for your help
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now