Member Avatar for westsiderailway

Hello Everyone,

This time i am not asking for any help :-)

I am showing anybody ,who wants to know how to add a $ sign into any item/subitem in Listview.

Did try to add colour,BUT, there is a BUG in VS. you can code for differant colours in subitems,BUT the BUG will not show these colours.

And now back to what I was talking about..hehehe

   For N As Integer = 0 To LV1.Items.Count - 1
            LV1.Items(N).SubItems(7).Text = "$" & LV1.Items(N).SubItems(7).Text
        Next

The above code, will insert the "$" symbol into the 7 column in your Listview. That is what i wanted, all you have to do is change the column number , to what ever column you want.
Of course it could be any symbol that you want to insert.....

What I did was fill the ListView first and then, just add the "$" symbol afterwards.

Hope somebody find this usefull, this is what I have been playing around with this afternoon.

Recommended Answers

All 2 Replies

You can use Format() function to attach a $ or Currency Symbol before the value.
It should be like

For N As Integer = 0 To LV1.Items.Count - 1
   LV1.Items(N).SubItems(7).Text = String.Format("{0:C}", Val(LV1.Items(N).SubItems(7).Text))
Next

Hope it can help you.

Member Avatar for westsiderailway

thanks for the TIP . :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.