VB中的Listview控件 [英] Listview control in VB

查看:118
本文介绍了VB中的Listview控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的应用程序有一个要求:

有一个用vb开发的应用程序.该应用程序具有一个数据库,其中包含所有基金ID,基金名称等.

该应用程序使用此数据库来完成我们生成的切换字母/切换电子表格.

发生此问题是因为某些基金具有相同的基金名称,但具有不同的基金ID.

例如:-

基金编号系统基金名称

829 Av阿伯丁NthAmerEqtyS2

905 Av阿伯丁NthAmerEqtyS2

如您所见,名称是相同的.

由于我们不包含基金ID,因此这不会对我们产生的转换函产生问题.

但是,对于有时生成的Switch电子表格,它确实包含基金ID,因此,对于上面的示例,我们将报价829作为基金ID,而不是905.

这向我暗示,我们正在从基金名称"中确定基金ID,而不是从基金ID"中确定基金名称.

根据我在此应用程序中的分析,正在使用一些列表视图,并且在从数据库中获取数据后仅显示字段值.但是在Excelsheet中打印其创建探针时,出现错误的值(基金代码在excelspread表中)这是不正确的.

Hi,
There is one requirement is my application:

There is application which is developed in vb.The application has a database that holds all the fund ID''s, fund names etc.

The application uses this database to complete the switch letters/switch spreadsheet we produce.

The issue is occuring because some funds have the same Fund Name but different Fund ID''s.

For Example:-

Fund ID System Fund Name

829 Av Aberdeen NthAmerEqtyS2

905 Av Aberdeen NthAmerEqtyS2

As you can see the names are the same.

This doesn''t cause an issue with the Switch Letters we produce as we do not include the Fund ID.

However, for the Switch spreadsheet that is sometimes produced, this does include the Fund ID & therefore, for the example above, we would quote 829 as the Fund ID rather than 905.

This would suggest to me that we are working out the Fund ID from the Fund Name rather than working out the Fund Name from the Fund ID.

As per my analysis in this application there are some listviews are being used and there only the field values are displaying after fetching he data from the DB.But while printing in the Excelsheet its creatng probem.Wrong value(Fund code is comming in excelspread sheet)which are not correct.
Could you anyone have a look on this and have a response regarding this ssue.

推荐答案

我认为您说的是分组模型,

I think you said the grouping model,

Public Sub ListviewFill_Group()
        Try
            Dim lvGroup As ListViewGroup
            Dim lvItem As ListViewItem

            sLV.lv.Items.Clear()
//Select Distinct(FundID) From FundDetails...
            rsSql = objConn.ResultSet("PLACE your Sql Query")
            If rsSql.HasRows Then
                Do While rsSql.Read
                    'MsgBox(rsSql.Item(0))
                    lvGroup = New ListViewGroup(rsSql.Item(0))
                    lvGroup.Items.Add(rsSql.Item(0))
                    sLV.lv.Groups.Add(lvGroup)
                    'rsSql1 = objConn.ResultSet(sLV.lvSub & " where " & sLV.lvWhereCondForSub)
                    If sLV.lvOrderBy <> "" Then
                        SQry = sLV.lvSub & " where " & sLV.lvDistColumn & "='" & rsSql.Item(1) & "' Order by " & sLV.lvOrderBy & " ASC"
                    Else
                        SQry = sLV.lvSub & " where " & sLV.lvDistColumn & "='" & rsSql.Item(1) & "'"
                    End If
                    rsSql1 = objConn.ResultSet(SQry)
                    If rsSql1.HasRows Then
                        Do While rsSql1.Read
                            lvItem = New ListViewItem(New String() {rsSql1.Item(0), rsSql1.Item(1), rsSql1.Item(2), rsSql1.Item(3), rsSql1.Item(4)}, 1, lvGroup)
                            ' lvItem.Group = lvGroup
                            sLV.lv.Items.Add(lvItem)
                        Loop
                    End If
                    rsSql1 = Nothing

                Loop
            End If
            'sLV.lv.Groups.Add(lvGroup)


        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical)
        End Try
    End Sub


这篇关于VB中的Listview控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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