Kingcoder210 0 Light Poster

Which datagrid should I use in vb.net? Which grid works like mshflexgrid? I have used mshflexgrid in my vb.net project as a result it shows error when I am trying to build my project! Please check my code & tell me which grid will support my code. Please add example with your answer because I am just a beginner.

My frist grid code :

Public Class Form7

    Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.CREATEUSERToolStripMenuItem.Enabled = False
        Me.DELETEUSERToolStripMenuItem.Enabled = False
        Me.CHANGEPASSWORDToolStripMenuItem.Enabled = False
        Me.ASSIGNPERMISSIONToolStripMenuItem.Enabled = False
        Me.SHOWALLToolStripMenuItem.Enabled = False
        Me.CREATEACADEMICYEARToolStripMenuItem.Enabled = False
        Me.DELETEACADEMICYEARToolStripMenuItem.Enabled = False
        Me.CREATESESSIONToolStripMenuItem.Enabled = False
        Me.DELETESESSIONToolStripMenuItem.Enabled = False
        Me.CREATEDEPARTMENTToolStripMenuItem.Enabled = False
        Me.DELETEDEPARTMENTToolStripMenuItem.Enabled = False
        Me.CREATEEXAMTYPEToolStripMenuItem.Enabled = False
        Me.DELETEEXAMTYPEToolStripMenuItem.Enabled = False
        Me.CREATESUBJECTToolStripMenuItem.Enabled = False
        Me.DELETESUBJECTToolStripMenuItem.Enabled = False
        Me.ADMISSIONToolStripMenuItem.Enabled = False
        Me.DELETEADMISSIONToolStripMenuItem.Enabled = False
        Me.ADMISSIONREPORTToolStripMenuItem.Enabled = False
        Me.STUDENTINFORMATIONToolStripMenuItem.Enabled = False
        Me.DELETESTUDENTINFORMATIONToolStripMenuItem.Enabled = False
        Me.SEARCHSTUDENTINFORMATIONToolStripMenuItem.Enabled = False
        Me.STUDENTINFORMATIONREPORTToolStripMenuItem.Enabled = False
        Me.CREATESTUDENTRESULTToolStripMenuItem.Enabled = False
        Me.DELETESTUDENTRESULTToolStripMenuItem.Enabled = False
        Me.STUDENTRESULTREPORTToolStripMenuItem.Enabled = False
        Me.RESULTSHEETREPORTToolStripMenuItem.Enabled = False
        Me.CREATEMONTHLYINSTALLMENTToolStripMenuItem.Enabled = False
        Me.DELETEMONTHLYINSTALLMENTToolStripMenuItem.Enabled = False
        Me.MONTHLYINSTALLMENTREPORTToolStripMenuItem.Enabled = False
        Me.CREATEBALANCESHEETToolStripMenuItem.Enabled = False
        Me.DELETEBALANCESHEETToolStripMenuItem.Enabled = False
        Me.BALANCESHEETREPORTToolStripMenuItem.Enabled = False
        Me.ABOUTTHISPROGRAMToolStripMenuItem.Enabled = False
        Me.EXIToolStripMenuItem.Enabled = False
    End Sub

    Private Sub butsaluclo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butsaluclo.Click
        speak7.Speak("Show all users window has been closed successfully")
        Me.Close()
    End Sub
    Public Function refreshMyForm() As Boolean
        con = New ADODB.Connection
        con.Open("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SUIMT")
        rst = New ADODB.Recordset


        With rst
            .Open("Select Uname, Upass, smad_cuser, smad_duser, smad_cpass, smad_apermi, smad_soall, smsm_cay, smsm_day, smsm_csess, smsm_delses, smsm_cdep, smsm_deldep, smsm_cetyp, smsm_deletyp, smsm_csub, smsm_delsub, smsm_admi, smsm_deladmi, smsm_admirep, smsm_stuinfo, smsm_delstuinfo, smsm_sstuinfo, smsm_stuinfrep, smsm_cstures, smsm_delstures, smsm_sturesrep, smsm_rsrep, sma_cmi, sma_dmi, sma_mirep, sma_cbalsht, sma_delbsht, sma_balsrep from Permission_info", con, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
            Mshgrid1.DataSource = rst

            Mshgrid1.set_TextMatrix(0, 0, "USER NAME")


            Mshgrid1.set_TextMatrix(0, 1, "PASSWORD")


            Mshgrid1.set_TextMatrix(0, 2, "CREATE USER")


            Mshgrid1.set_TextMatrix(0, 3, "DELETE USER")


            Mshgrid1.set_TextMatrix(0, 4, "CHANGE PASSWORD")


            Mshgrid1.set_TextMatrix(0, 5, "ASSIGN PERMISSION")


            Mshgrid1.set_TextMatrix(0, 6, "SHOW ALL USERS")


            Mshgrid1.set_TextMatrix(0, 7, "CREATE ACADEMIC YEAR")


            Mshgrid1.set_TextMatrix(0, 8, "DELETE ACADEMIC YEAR")


            Mshgrid1.set_TextMatrix(0, 9, "CREATE SESSION")


            Mshgrid1.set_TextMatrix(0, 10, "DELETE SESSION")


            Mshgrid1.set_TextMatrix(0, 11, "CREATE DEPARTMENT")


            Mshgrid1.set_TextMatrix(0, 12, "DELETE DEPARTMENT")


            Mshgrid1.set_TextMatrix(0, 13, "CREATE EXAM TYPE")


            Mshgrid1.set_TextMatrix(0, 14, "DELETE EXAM TYPE")


            Mshgrid1.set_TextMatrix(0, 15, "CREATE SUBJECT")


            Mshgrid1.set_TextMatrix(0, 16, "DELETE SUBJECT")


            Mshgrid1.set_TextMatrix(0, 17, "ADMISSION")


            Mshgrid1.set_TextMatrix(0, 18, "DELETE ADMISSION")


            Mshgrid1.set_TextMatrix(0, 19, "ADMISSION REPORT")


            Mshgrid1.set_TextMatrix(0, 20, "STUDENT INFORMATION")


            Mshgrid1.set_TextMatrix(0, 21, "DELETE STUDENT INFORMATION")


            Mshgrid1.set_TextMatrix(0, 22, "SEARCH STUDENT INFORMATION")


            Mshgrid1.set_TextMatrix(0, 23, "STUDENT INFORMATION REPORT")


            Mshgrid1.set_TextMatrix(0, 24, "CREATE STUDENT RESULT")


            Mshgrid1.set_TextMatrix(0, 25, "DELETE STUDENT RESULT")


            Mshgrid1.set_TextMatrix(0, 26, "STUDENT RESULT REPORT")


            Mshgrid1.set_TextMatrix(0, 27, "RESULT SHEET REPORT")


            Mshgrid1.set_TextMatrix(0, 28, "CREATE MONTHLY INSTALLMENT")


            Mshgrid1.set_TextMatrix(0, 29, "DELETE MONTHLY INSTALLMENT")


            Mshgrid1.set_TextMatrix(0, 30, "MONTHLY INSTALLMENT REPORT")


            Mshgrid1.set_TextMatrix(0, 31, "CREATE BALANCE SHEET")


            Mshgrid1.set_TextMatrix(0, 32, "DELETE BALANCE SHEET")


            Mshgrid1.set_TextMatrix(0, 33, "BALANCE SHEET REPORT")


            Mshgrid1.set_ColWidth(0, 3200)
            Mshgrid1.set_ColWidth(1, 3200)
            Mshgrid1.set_ColWidth(2, 3200)
            Mshgrid1.set_ColWidth(3, 3200)
            Mshgrid1.set_ColWidth(4, 3200)
            Mshgrid1.set_ColWidth(5, 3200)
            Mshgrid1.set_ColWidth(6, 3200)
            Mshgrid1.set_ColWidth(7, 3200)
            Mshgrid1.set_ColWidth(8, 3200)
            Mshgrid1.set_ColWidth(9, 3200)
            Mshgrid1.set_ColWidth(10, 3200)
            Mshgrid1.set_ColWidth(11, 3200)
            Mshgrid1.set_ColWidth(12, 3200)
            Mshgrid1.set_ColWidth(13, 3200)
            Mshgrid1.set_ColWidth(14, 3200)
            Mshgrid1.set_ColWidth(15, 3200)
            Mshgrid1.set_ColWidth(16, 3200)
            Mshgrid1.set_ColWidth(17, 3200)
            Mshgrid1.set_ColWidth(18, 3200)
            Mshgrid1.set_ColWidth(19, 3200)
            Mshgrid1.set_ColWidth(20, 3200)
            Mshgrid1.set_ColWidth(21, 3200)
            Mshgrid1.set_ColWidth(22, 3200)
            Mshgrid1.set_ColWidth(23, 3200)
            Mshgrid1.set_ColWidth(24, 3200)
            Mshgrid1.set_ColWidth(25, 3200)
            Mshgrid1.set_ColWidth(26, 3200)
            Mshgrid1.set_ColWidth(27, 3200)
            Mshgrid1.set_ColWidth(28, 3200)
            Mshgrid1.set_ColWidth(29, 3200)
            Mshgrid1.set_ColWidth(30, 3200)
            Mshgrid1.set_ColWidth(31, 3200)
            Mshgrid1.set_ColWidth(32, 3200)
            Mshgrid1.set_ColWidth(33, 3200)
            .Close()
            refreshMyForm = True
            Exit Function
        End With
    End Function
  
    Private Sub butsalus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butsalus.Click
        Call refreshMyForm()
        speak7.Speak("All users has been shown successfully")
    End Sub
    Private Sub ADMINISTRATIONToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ADMINISTRATIONToolStripMenuItem.Click
        speak7.Speak("Administration")
    End Sub

    Private Sub STUDENTMANAGEMENTToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles STUDENTMANAGEMENTToolStripMenuItem1.Click
        speak7.Speak("Student management")
    End Sub

    Private Sub ACCOUNTANCYToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ACCOUNTANCYToolStripMenuItem1.Click
        speak7.Speak("Accountancy")
    End Sub

    Private Sub ABOUTITToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ABOUTITToolStripMenuItem.Click
        speak7.Speak("About it")
    End Sub

    Private Sub EXITToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EXITToolStripMenuItem.Click
        speak7.Speak("Exit")
    End Sub
End Class

Second grid code :

Public Class Form32

    Private Sub Form32_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        cmbdbsdt.Items.Clear()
        cmbdbsdt.Text = "DATE"
        txtdbsrn.Text = "ROW NUMBER"
        con = New ADODB.Connection
        con.Open("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SUIMT")
        rst = New ADODB.Recordset
        With rst
            .Open("Select * From Bal_sheet", con, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)
            If .BOF = False Then
                .MoveFirst()
                While .EOF = False
                    If Not cmbdbsdt.Items.Contains(.Fields("bsdate").Value) Then
                        cmbdbsdt.Items.Add(.Fields("bsdate").Value)
                    End If
                    .MoveNext()
                End While
            End If
            .Close()
        End With
      
        Me.CREATEUSERToolStripMenuItem.Enabled = False
        Me.DELETEUSERToolStripMenuItem.Enabled = False
        Me.CHANGEPASSWORDToolStripMenuItem.Enabled = False
        Me.ASSIGNPERMISSIONToolStripMenuItem.Enabled = False
        Me.SHOWALLToolStripMenuItem.Enabled = False
        Me.CREATEACADEMICYEARToolStripMenuItem.Enabled = False
        Me.DELETEACADEMICYEARToolStripMenuItem.Enabled = False
        Me.CREATESESSIONToolStripMenuItem.Enabled = False
        Me.DELETESESSIONToolStripMenuItem.Enabled = False
        Me.CREATEDEPARTMENTToolStripMenuItem.Enabled = False
        Me.DELETEDEPARTMENTToolStripMenuItem.Enabled = False
        Me.CREATEEXAMTYPEToolStripMenuItem.Enabled = False
        Me.DELETEEXAMTYPEToolStripMenuItem.Enabled = False
        Me.CREATESUBJECTToolStripMenuItem.Enabled = False
        Me.DELETESUBJECTToolStripMenuItem.Enabled = False
        Me.ADMISSIONToolStripMenuItem.Enabled = False
        Me.DELETEADMISSIONToolStripMenuItem.Enabled = False
        Me.ADMISSIONREPORTToolStripMenuItem.Enabled = False
        Me.STUDENTINFORMATIONToolStripMenuItem.Enabled = False
        Me.DELETESTUDENTINFORMATIONToolStripMenuItem.Enabled = False
        Me.SEARCHSTUDENTINFORMATIONToolStripMenuItem.Enabled = False
        Me.STUDENTINFORMATIONREPORTToolStripMenuItem.Enabled = False
        Me.CREATESTUDENTRESULTToolStripMenuItem.Enabled = False
        Me.DELETESTUDENTRESULTToolStripMenuItem.Enabled = False
        Me.STUDENTRESULTREPORTToolStripMenuItem.Enabled = False
        Me.RESULTSHEETREPORTToolStripMenuItem.Enabled = False
        Me.CREATEMONTHLYINSTALLMENTToolStripMenuItem.Enabled = False
        Me.DELETEMONTHLYINSTALLMENTToolStripMenuItem.Enabled = False
        Me.MONTHLYINSTALLMENTREPORTToolStripMenuItem.Enabled = False
        Me.CREATEBALANCESHEETToolStripMenuItem.Enabled = False
        Me.DELETEBALANCESHEETToolStripMenuItem.Enabled = False
        Me.BALANCESHEETREPORTToolStripMenuItem.Enabled = False
        Me.ABOUTTHISPROGRAMToolStripMenuItem.Enabled = False
        Me.EXIToolStripMenuItem.Enabled = False
    End Sub

    Private Sub ADMINISTRATIONToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ADMINISTRATIONToolStripMenuItem.Click
        speak32.Speak("Administration")
    End Sub

    Private Sub STUDENTMANAGEMENTToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles STUDENTMANAGEMENTToolStripMenuItem1.Click
        speak32.Speak("Student management")
    End Sub

    Private Sub ACCOUNTANCYToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ACCOUNTANCYToolStripMenuItem1.Click
        speak32.Speak("Accountancy")
    End Sub

    Private Sub ABOUTITToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ABOUTITToolStripMenuItem.Click
        speak32.Speak("About it")
    End Sub

    Private Sub EXITToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EXITToolStripMenuItem.Click
        speak32.Speak("Exit")
    End Sub

    Private Sub cmbdbsdt_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbdbsdt.Leave
        On Error Resume Next
        rst = New ADODB.Recordset
        With rst
            .Open("Select row_num, soincom, amouoinco, soexp, amouoexp, bsdate from Bal_sheet where bsdate = '" & cmbdbsdt.Text & "'", con, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
            Mshgrid3.DataSource = rst

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

            Mshgrid3.set_TextMatrix(0, 1, "SOURCE OF INCOME")

            Mshgrid3.set_TextMatrix(0, 2, "AMOUNT OF INCOME")

            Mshgrid3.set_TextMatrix(0, 3, "SOURCE OF EXPENSE")

            Mshgrid3.set_TextMatrix(0, 4, "AMOUNT OF EXPENSE")

            Mshgrid3.set_TextMatrix(0, 5, "DATE")


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

  
    Private Sub butdbsdel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butdbsdel.Click
        With rst
            .Open("Select * From Bal_sheet where row_num = '" & txtdbsrn.Text & "'", con, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
            .Delete()
            .Close()
            cmbdbsdt.Text = "DATE"
            cmbdbsdt.Items.Clear()
            txtdbsrn.Text = "ROW NUMBER"
        End With
        rst = New ADODB.Recordset
        With rst
            .Open("Select * From Bal_sheet", con, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)
            If .BOF = False Then
                .MoveFirst()
                While .EOF = False
                    If Not cmbdbsdt.Items.Contains(.Fields("bsdate").Value) Then
                        cmbdbsdt.Items.Add(.Fields("bsdate").Value)
                    End If
                    .MoveNext()
                End While
            End If
            .Close()
        End With
        Mshgrid3.Clear()
        Mshgrid3.set_TextMatrix(0, 0, "ROW NUMBER")

        Mshgrid3.set_TextMatrix(0, 1, "SOURCE OF INCOME")

        Mshgrid3.set_TextMatrix(0, 2, "AMOUNT OF INCOME")

        Mshgrid3.set_TextMatrix(0, 3, "SOURCE OF EXPENSE")

        Mshgrid3.set_TextMatrix(0, 4, "AMOUNT OF EXPENSE")

        Mshgrid3.set_TextMatrix(0, 5, "DATE")


        Mshgrid3.set_ColWidth(0, 2500)
        Mshgrid3.set_ColWidth(1, 2500)
        Mshgrid3.set_ColWidth(2, 2500)
        Mshgrid3.set_ColWidth(3, 2500)
        Mshgrid3.set_ColWidth(4, 2500)
        Mshgrid3.set_ColWidth(5, 2500)
        speak32.Speak("Balance sheet has been deleted successfully")
    End Sub

    Private Sub butdbsclo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butdbsclo.Click
        speak32.Speak("Delete balance sheet window has been closed successfully")
        Me.Close()
    End Sub

    Private Sub txtdbsrn_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtdbsrn.GotFocus
        txtdbsrn.Text = ""
    End Sub

  
End Class