troubleshooting Question

Help with formatting data entered in a list box from a Masked textbox

Avatar of vcharles
vcharles asked on
1 Comment1 Solution414 ViewsLast Modified:

I am using three Masked input textboxes in the following format:

a. xxx-xx-xxx-xxxx
b. xxx,xxx
c. xx-xxx

When I enter the data in my textbox, for example format a, looks like 1305-98-987-7687

However when I copy the data to the listbox, it looks like 1-1305989877687

How do I modify the code below to copy the data to the list box in the following format

1- 1305-98-987-7687?  


Protected Sub ANSN_Click(sender As Object, e As EventArgs) Handles ANSN.Click
        C1NSN.DataBind() 'New Line
    End Sub
    Sub FormatListBox()
        For i As Integer = C1NSN.Items.Count - 1 To 0 Step -1
         C1NSN.Items(i).Text = i + 1 & "-" & C1NSN.Items(i).ToString    
         If i Mod 2 = 0 Then
         C1NSN.Items(i).Attributes.Add("style", "background-color: Yellow")
            End If
    End Sub
Shaun Kline
Lead Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros