views:

40

answers:

1

I have used mshflexgrid for my vb.net program. But it shows error when I try to build because vb.net doesnt support mshflexgrid. Please check my code & tell me what should I do to do same thing there in datagridview? Datagridview doesnt support same code. So would you please tell me what should I write for it? Please check my code.

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 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 

Please edit my code & tell me what should I write for datagridview.

+1  A: 

For the first grid, which you seem to populate straight from a DB, look at this article:
How to: Bind Data to the Windows Forms DataGridView Control

For the second grid, which you seem to populating manually, look at this article:
Walkthrough: Creating an Unbound Windows Forms DataGridView Control

Those two articles together should give you enough information to get started, and if you get stuck on anything, ask a more specific question here and I'm sure someone will help out.

ho1