如何在Gridview中显示之前更改数字符号 [英] How Do I Change The Sign Of Number Before Showing It In Gridview
问题描述
您好。
我从sql数据库中获取一个数字到网格视图。数字正在显示。但我希望即使在负数的情况下,也只显示没有符号的数字。
以下是我用于每行datagrid的代码:< br $>
DataGridView1.Columns(0).DataPropertyName =FAAMOB
请帮助。
我试图使用一个功能来改变标志但不能提供这个号码。
< pre lang =vb> Dim DA As SqlDataAdapter = 新 SqlDataAdapter
DA.SelectCommand = 新 SqlCommand( 从FAAM选择FAAMOB,连接)
Dim 数据表作为 新 DataTable
DA.Fill(datatable)
DataGridView1 .AutoG enerateColumns = False
DataGridView1.DataSource = datatable
对于 < span class =code-keyword>每个行 As DataGridViewRow In DataGridView1.Rows
DataGridView1.Columns( 0 )。DataPropertyName = FAAMOB
下一步
你需要在数据集上应用循环而不是DataGridView并在循环中添加条件。
Ankur
完成它:
我创建了一个删除标志的小函数并更改了网格单元格的值
感谢您的支持
Hello.
I am fetching a Number from sql database to a grid view. And the number is showing. But I want that even in case of a negative number, only the number without sign is showing.
following is the code i am using for each row of datagrid:
DataGridView1.Columns(0).DataPropertyName = "FAAMOB"
Pls help.
I have tried to use a function for changing the sign but not able to provide it with the number.
Dim DA As SqlDataAdapter = New SqlDataAdapter
DA.SelectCommand = New SqlCommand("Select FAAMOB from FAAM " , connection)
Dim datatable As New DataTable
DA.Fill(datatable)
DataGridView1.AutoGenerateColumns = False
DataGridView1.DataSource = datatable
For Each row As DataGridViewRow In DataGridView1.Rows
DataGridView1.Columns(0).DataPropertyName = "FAAMOB"
Next
You need to apply loop on dataset instead of DataGridView and add condition with in the loop.
Ankur
done it:
I created a small function of removing the sign and changed the value of grid cell
Thanks for support
这篇关于如何在Gridview中显示之前更改数字符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!