[Gambas-user] Money type in correct representation PT_BR
Fabricio Silva
buxaman at ...626...
Mon Sep 11 15:08:46 CEST 2006
Helo,
In Brazil the currency is displayed like this: R$ 147,00 R$ 3.521,00 and
so on. I'm using SuSE 10.0, mysql 4.1 and Gambas 1.9.34. Before saving data
I used: txtprice.Text = Replace$(txtprice.Text, ",", ".") because I use a
decimal (7,2) data type. Now I'm trying to display it to the users using a
table view but I'm stuck in how to tell gambas only to change the correct
values. I tryed Format without sucess. There's another issue that I can't
figure out in this code of mine. There's some sort of loop messing up
things.... I inserted a:
PRINT (global.rs1[arrtable[Column]])
just before:
global.rs1.MoveTo(Row)
And saw it repeat the value many times. Why?
Tanks in advance
The code:
------------------------------------Product
Class-------------------------------------------
arrtable[4] AS String
PUBLIC global AS principal
PUBLIC i AS String
PUBLIC SUB form_open()
global = NEW principal
global.conection()
db.Close
db.Open
show_data()
END
PUBLIC SUB show_data()
DIM sql AS String
WITH tableview1
.rows.count = 0
.columns.count = 4
.columns[0].text = "Code"
.columns[0].Width = 50
.columns[1].text = "Description"
.columns[1].Width = 300
.Columns[2].Text = "Quantity"
.columns[2].Width = 80
.columns[3].text = "Price"
.columns[3].Width = 70
END WITH
sql = "SELECT code, description, quantity, price FROM product ORDER BY
code ASC"
global.fill(tableview1, sql)
END
PUBLIC SUB tableview1_Data(Row AS Integer, Column AS Integer)
arrtable[0] = "code"
arrtable[1] = "description"
arrtable[2] = "quantity"
arrtable[3] = "price"
global.rs1.MoveTo(Row)
tableview1.data.Text = CStr(global.rs1[arrtable[Column]])
'tableview1.data.Text = Format$(Val(global.rs1[arrtable[Column]]), "#,00")
END
--------------------------Relevant part of Principal
Class-------------------------------------------
PUBLIC rs AS Result
PUBLIC rs1 AS Result
STATIC PUBLIC db AS NEW Connection
PUBLIC CONST dbname AS String = "geral"
PUBLIC CONST host AS String = "localhost"
PUBLIC CONST passw AS String = "teste"
PUBLIC CONST login AS String = "root"
STATIC PUBLIC FUNCTION conection() AS Boolean
db.Type = "mysql"
db.Host = host
db.Login = login
db.Password = passw
db.Name = dbname
RETURN TRUE
CATCH
RETURN FALSE
END
PUBLIC SUB fill(tbv AS tableview, qry AS String)
DIM i AS Float
rs1 = db.exec(qry)
WITH rs1
tbv.rows.count = 0
IF .count <> 0 THEN
tbv.columns.count = .fields.count
tbv.rows.count = .count
END IF
END WITH
END
More information about the User
mailing list