Sample Codes For Activex Control - Appendices
6. Appendices
Appendix A: Class Module
Appendix B: Form ActiveX
Appendix C: Standard Module
Appendix D: Standard EXE Form code
6.1 Appendix A:
Option Explicit Public Function LoadForm(numbers_disp As Boolean, alphabets_disp As Boolean) 'Load the form Load frmActivexEx frmActivexEx.Caption = frmActivexEx.Caption 'make the controls on the form as disabled initailly frmActivexEx.cboAlphabets.Enabled = False frmActivexEx.cboNumbers.Enabled = False 'Based on the option user selected 'make its correspondins drop-down box enabled If numbers_disp = True Then frmActivexEx.cboNumbers.Enabled = True ElseIf alphabets_disp = True Then frmActivexEx.cboAlphabets.Enabled = True End If frmActivexEx.Show End Function Private Sub Class_Initialize() 'selectedItem is a global variable declared in module 'set it to nothing initially 'whcih implies that no item has been selected selectedItem = "Nothing" End Sub Private Sub Class_Terminate() 'on terminating unload the form Unload frmActivexEx End Sub Public Function getselectedchar() As String 'function that gets the item selected in the drop-down box getselectedchar = selectedItem End Function