The ActiveX control ( MKDataGrid1) when adding the file VB6DataGrid.ocx to Toolbox.When extracting the file, MKDataGrid.zip, you can find the file VB6DataGrid.ocx in the folder ActiveXcontrol.įind database files School_A.mdb and School_E.mdb in the folder DataFiles.įind the project prjDataGrid to test the ActiveX control in the folder MKDataGrid. You can go back to the source files of the project ( prjDataGrid) to read more than the previous examples. MKDataGrid1.ListControl 5, adoCountries, " CountryName" MKDataGrid1.ListControl 4, adoCities, " CityName" ' List box at column #5 include 'CountryName' field MKDataGrid1.DateControl 2, True ' Date control at column #2 ' List box at column #4 include 'CityName' field
#True dbgrid vb6 download free code#
& " ORDER BY CountryID " Set adoCountries = New RecordsetĪdoCountries.Open CountrySql, cn initGrid() ProcedureĬopy Code LoadData ' load data from database file ' We shall fill the combo box with 'CountryName' fieldĬountrySql = " SELECT DISTINCTROW CountryID, CountryName " _ & " ORDER BY CityID " Set adoCities = New Recordset MKDataGrid1.DataSource = adoStudents ' Important: Not use (Set) statement her ' We shall fill the combo box with 'CityName' fieldĬitySql = " SELECT DISTINCTROW CityID, CityName " _ & " Order by StudentID" Set adoStudents = New ADODB.RecordsetĪdoStudents.Open StudentSql, cn, adOpenStatic, adLockOptimistic Using the Code LoadData() procedureĬopy Code ' Define following variables in General/Declarations ' Dim adoStudents As ADODB.Recordset ' Dim adoCities As ADODB.Recordset ' Dim adoCountries As ADODB.Recordset ' Dim CitySql As String ' Dim CountrySql As String Dim cn As ADODB.Connectionĭim DataFile As String Dim StudentSql As StringĭataFile = App.Path + " \DataFiles\" + " School_E.mdb" Set cn = New ADODB.ConnectionĬn.Open " PROVIDER=.3.51 Data Source=" & DataFile & " " ' Load data to the gridStudentSql = " SELECT StudentID,StudentName,BirthDate," _ To use my ActiveX ( MKDataGrid), you must add only one file from files: msado20.tlb, msado21.tlb, msado25.tlb or msado27.tlb to Interface from the folder C:\WINDOWS\SYSTEM32 and add ( MKDataGrid) control to the Toolbox. MKDataGrid1.ListControl 4, adoCities, "CityName" Set ComboBox control at column c with Recordset rs and Field f. Set DTPicker control at column c if b = True MKDataGrid1.GridCaption = "School data base" My ActiveX control has some methods and some properties in the following table, refer to MSDataGrid for other methods and properties: Method/Property When using my ActiveX control ( MKDataGrid), you must load the grid with data from database file, see the code in form2 and form3. Fill the field which has Date data type.Choose items from ComboBox to fill any field in the DataGrid.Now I create a new AciveX for using ( MSDataGrid) and include ( ComboBox) and ( DTPicker) control to any column in the DataGrid. To see this ActiveX and its application, click here. I wrote an article before about ActiveX using ( MSFlexGrid) to edit cells and include ( ComboBox) in any column in the FlexGrid.
#True dbgrid vb6 download free download#