将嵌套结构绑定到datagridview

时间:2011-11-15 00:35:39

标签: .net vb.net datagridview

我有两个结构,其中一个是嵌套的。

Public Structure RetailRpt
    Public FromDate As Date
    Public ToDate As Date
    Public GenDate As Date
    Public RetailId As Integer
    Public TotalSellAmt As Integer
    Public CancelSellAmt As Integer
    Public NetSellAmt As Integer
    Public PayOut As Integer
    Public OperatorBal As Integer
    Public AgentDiscountAmt As Integer
    Public NetToPay As Integer
End Structure
Public Structure DSRpt
    Public FromDate As Date
    Public ToDate As Date
    Public GenDate As Date
    Public Retail() As RetailRpt <-- this one is nested
    Public NetSellAmt As Integer
    Public PayOut As Integer
    Public AgentDiscountAmt As Integer
    Public NetToPay As Integer
End Structure

我已经从datagridview的数据源添加了DSRPT结构。但遗憾的是,我无法在datagridview行中使用[+]显示嵌套结构数据。 请帮帮我,我在Window表单应用程序上使用VB.NET 提前谢谢。

1 个答案:

答案 0 :(得分:1)

我认为用传统的GridView完成它是非常困难的,我建议你使用MSFlexGrid,或者如果它对你来说太难看了,试试第三方控件,这里有一个关于它的线程:{{3 }}