I have a label that displays information from my database and I need to format it. It displays a number format like so: (53389) and I just need it to display (53,389)
it uses the SQL to COUNT or SUM the data from the datasource.
My first question is, is there a way to have it format like I want when it is displayed, or do I need to change the data format in the database?
here is my code:
Try Me.MAINTableAdapter.Fill(Me.MainDataSet.MAIN) Me.MAINTableAdapter1.FillByExceeds(Me.BurnListingDataSet.MAIN) Catch ex As Exception End Try Try Dim arx As Integer arx = MainDataSet.Tables("MAIN").Rows.Count Dim cmd As OleDbCommand = New OleDbCommand("SELECT SUM(BurnSize) FROM MAIN", con) Dim cmd2 As OleDbCommand = New OleDbCommand("SELECT COUNT(BurnSize) FROM MAIN", con) con.Open() Try Dim acrestotal As Int32 = cmd.ExecuteScalar Dim burnscount As Int32 = cmd2.ExecuteScalar Label1.Text = "There are " & burnscount & " burns in the database for " & acrestotal & " total acres." Catch ex As Exception MsgBox("Error getting data!", MsgBoxStyle.Information, "Error...") End Try con.Close() Catch ex As Exception End Try
Label1.text is what I am wanting to format, both the variables.