net中使用mshflexgrid

net中使用mshflexgrid

本文介绍了我如何在vb.net中使用mshflexgrid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道如何使用adodb在datagridview中显示记录?

我用过mshflexgrid&它运作良好,但是当我尝试构建程序时,它显示错误,提示未定义AxMSHierarchicalFlexGridLib.AxMSHFlexGrid" .

我将分享我为mshflexgrid编写的代码以显示记录的代码.请检查&告诉我应该怎么做,或者通过使用adodb来写以显示datagridview中的记录,或者如果我使用mshflexgrid,那么在构建程序时如何摆脱该错误.
我的代码:

I need to know how can I show records in datagridview by using adodb?

I have used mshflexgrid & it workded well but when I try to build my program it shows error that "AxMSHierarchicalFlexGridLib.AxMSHFlexGrid'' is not defined".

I am going to share my code what I have written for mshflexgrid to show record. Please check it & tell me what should I do or write to show record in datagridview by using adodb or if I use mshflexgrid how can I get rid of that error when I will build my program.
My code:

Private Sub Form34_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

con = New ADODB.Connection

con.Open("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SUIMT")

End Sub

Private Sub cmbdmidt_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbdmidt.Leave
    On Error Resume Next
    rst = New ADODB.Recordset
    With rst
        .Open("Select row_num, stu_id, tot_amou, paid, du, aoins, due, dt From monthly_instal where stu_id = '" & cmbdmiidn.Text & "' AND dt = '" & cmbdmidt.Text & "'", con, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)

        Mshgrid2.DataSource = rst

        Mshgrid2.set_TextMatrix(0, 0, "ROW NUMBER")

        Mshgrid2.set_TextMatrix(0, 1, "ID NUMBER")

        Mshgrid2.set_TextMatrix(0, 2, "TOTAL AMOUNT")

        Mshgrid2.set_TextMatrix(0, 3, "PAID")

        Mshgrid2.set_TextMatrix(0, 4, "DUE")

        Mshgrid2.set_TextMatrix(0, 5, "AMOUNT OF INSTALLMENT")

        Mshgrid2.set_TextMatrix(0, 6, "DUE")

        Mshgrid2.set_TextMatrix(0, 7, "DATE")

        Mshgrid2.set_ColWidth(0, 2500)
        Mshgrid2.set_ColWidth(1, 2500)
        Mshgrid2.set_ColWidth(2, 2500)
        Mshgrid2.set_ColWidth(3, 2500)
        Mshgrid2.set_ColWidth(4, 2500)
        Mshgrid2.set_ColWidth(5, 2500)
        Mshgrid2.set_ColWidth(6, 2500)
        Mshgrid2.set_ColWidth(7, 2500)
        .Close()
    End With
End Sub

推荐答案


这篇关于我如何在vb.net中使用mshflexgrid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 10:32