2 Replies - 1256 Views - Last Post: 09 March 2013 - 04:50 AM Rate Topic: -----

#1 Blacksyntax181   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 22-December 12

float values in listview

Posted 06 March 2013 - 10:06 PM

I want to display the float value in LISTVIEW IN vb.net from mysql database:

float from database: 1000.00
1923.10

when i retrieve the values from mysql to Listview the output became:
1000
1000.1


With ListView1

.Clear()

.View = View.Details
.FullRowSelect = True
.GridLines = True

.Columns.Add("Account_Title", 335)
.Columns.Add("Beginning", 335, HorizontalAlignment.Right)

ssql = "SELECT Account_Title,Beginning from general_ledger ORDER BY Item ASC"



Help...
anyone.

View PostBlacksyntax181, on 06 March 2013 - 10:04 PM, said:

I want to display the float value in LISTVIEW IN vb.net from mysql database:

float from database: 1000.00
1923.10

when i retrieve the values from mysql to Listview the output became:
1000
1000.1


With ListView1

.Clear()

.View = View.Details
.FullRowSelect = True
.GridLines = True

.Columns.Add("Account_Title", 335)
.Columns.Add("Beginning", 335, HorizontalAlignment.Right)

ssql = "SELECT Account_Title,Beginning from general_ledger ORDER BY Item ASC"



Help...
anyone.

i wanted the output to became 1000.00 and 1923.10
thanks


Is This A Good Question/Topic? 0
  • +

Replies To: float values in listview

#2 CharlieMay   User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1729
  • View blog
  • Posts: 5,708
  • Joined: 25-September 09

Re: float values in listview

Posted 07 March 2013 - 05:29 AM

The good news is, you're storing the number properly in the database :D/>. A lot of people store this type of data as a string and then work with it when it comes out.

But to answer your question (and I'm not sure what method you're using to get the data out I'll leave you with this bit of information. You can set a format in the .ToString() method
Dim i as double = 1923.1
Messagebox(i.ToString("F2"))


using i.ToString("N2") would give a result with comma separators 1,923.10

Check out this link for a list of formats

This post has been edited by CharlieMay: 07 March 2013 - 06:02 AM

Was This Post Helpful? 1
  • +
  • -

#3 Blacksyntax181   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 22-December 12

Re: float values in listview

Posted 09 March 2013 - 04:50 AM

View PostCharlieMay, on 07 March 2013 - 05:29 AM, said:

The good news is, you're storing the number properly in the database :D/>/>. A lot of people store this type of data as a string and then work with it when it comes out.

But to answer your question (and I'm not sure what method you're using to get the data out I'll leave you with this bit of information. You can set a format in the .ToString() method
Dim i as double = 1923.1
Messagebox(i.ToString("F2"))


using i.ToString("N2") would give a result with comma separators 1,923.10

Check out this link for a list of formats



thanks a lot...i'll try this one...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1