如何避免listview中的空格 [英] How to Avoid Blank space in listview

查看:121
本文介绍了如何避免listview中的空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用列表视图显示来自Access DB的数据,我有一些没有数据的空间(null)...当我在列表视图中调用那些Feild时,它在几个地方显示空白区域,我想显示没有空格(如果有空)... PLZ给我解决方案...

例如我有一个地址,如果它是空的,它显示空的空间....它显示一些地址字段,所以如果地址不存在,idont需要空格...

解决方案

您需要从数据源中删除空值。如果他们在那里,他们将被包括在你的数据绑定



SA - 你怎么可能不清楚?


< blockquote>你也可以检查IsDBNull(),

如果DB为null则不在你的列表中显示,否则添加它。

  Dim  Row_Number  as 整数= 0 
对于 Row_Number = 0 DGVMaster.Rows.Count - 1
如果 IsDBNull(DGVName.Item( ColumnName,Row_Number).Value)然后
' 这里有什么代码将数据添加到列表中(Bcoz它们在这个块中不会空白)
Else
' 如果DB为空,则在此块中编写代码,然后是什么想要。
结束 如果
下一步


Am using List view to Display the data from Access DB,I Have some Feilds which Are Having No data(null) ... When i call those Feilds in my listview it dispalys blank space in few places, i want to dispaly without Blank space(if there is null)...plz give me solution...
For Example I Have a Address Feild,if it is empty it dispalys empty space....and it dispaly some address feilds,so idont want blank space if address not present...

解决方案

You need to strip the null values from your data source. If they are there, they will be included when you data bind

SA - how can this possibly not be clear to you ?


U can also check for IsDBNull(),
If DB is null then don''t show it in ur list,otherwise add it.

Dim Row_Number as Integer=0
For Row_Number = 0 To DGVMaster.Rows.Count - 1
 If Not IsDBNull(DGVName.Item("ColumnName", Row_Number).Value) Then
    'What here code to add data to list(Bcoz they will not blank in this block)
 Else 
    'Write code in this block if DB is Null,then what u want.
 End If
Next


这篇关于如何避免listview中的空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆