Hi,
I have a listbox with lstPartnumber as it's name. It displays multiple number items with quotation marks as: "abc".
I want to remove these quotation marks from each item in the listbox. Which property should I use to remove these quotation marks from the text of each item.
Thank you!
Loading

VulpesRank #55 · 29.2K reputationPosted Oct 14, 2011, 12:33 AM EDT
latika singh28 reputationPosted Oct 14, 2011, 4:43 AM EDT
So with items = items.Substring(1, items.Length - 3) it takes out the double quotation but displays them as "abc" since it is stored as string.
VulpesRank #55 · 29.2K reputationPosted Oct 14, 2011, 4:52 AM EDT
latika singh28 reputationPosted Oct 14, 2011, 9:50 AM EDT
VulpesRank #55 · 29.2K reputationPosted Oct 14, 2011, 10:57 AM EDT
Can you clarify what exactly is displayed in the ListBox?
If it's "abc" then this 'if' statement should be true:
If item.StartsWith("""") AndAlso item.EndsWith("""") Then
because the first and last characters of the string are double quote characters and because they need to be doubled when used in a VB string literal.
The following code definitely works as I've tried it myself to make absolutely sure:
End Class
Satyapriya NayakRank #47 · 31.5K reputationPosted Oct 28, 2011, 7:25 PM EDT
Try this......
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i As Integer = 0 To ListBox1.Items.Count - 1
ListBox1.Items(i) = ListBox1.Items(i).Replace(Chr(34), "" & "")
Next i
End Sub
End Class
Thanks
If this post helps you mark it as answer