本文介绍了如何在Gridview中显示之前更改数字符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 您好。 我从sql数据库中获取一个数字到网格视图。数字正在显示。但我希望即使在负数的情况下,也只显示没有符号的数字。 以下是我用于每行datagrid的代码: DataGridView1.Columns(0).DataPropertyName =FAAMOB 请帮助。 我试图使用一个功能来改变标志但不能提供这个号码。 Dim DA As SqlDataAdapter = 新 SqlDataAdapter DA.SelectCommand = 新 SqlCommand( 从FAAM选择FAAMOB,连接) Dim 数据表作为 新 DataTable DA.Fill(datatable) DataGridView1 .AutoG enerateColumns = False DataGridView1.DataSource = datatable 对于 每个行 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 SqlDataAdapterDA.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.Ankurdone it:I created a small function of removing the sign and changed the value of grid cellThanks for support 这篇关于如何在Gridview中显示之前更改数字符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 10:27