Programmer 的進程 - 由 VB6 開始

Xojo / RealBasic 相關文件及程式庫 => Xojo / RealBasic 範例及函式庫 => Topic started by: admin on August 23, 2011, 07:56:33 PM

Title: 以顯示內容找尋Combobox/Popupmenu相對位置
Post by: admin on August 23, 2011, 07:56:33 PM
Code: [Select]
Sub ShowListbyText(tmpControl As object, tmpKeyValue as string)
  Dim inty As integer
  select case tmpcontrol
  case isa ComboBox
    For intY = 0 To combobox(tmpControl).listcount -1
      if lowercase(combobox(tmpControl).list(inty))= lowercase(tmpKeyValue)  then
        combobox(tmpControl).listindex=inty
        exit for
      end if
    Next
   
  case isa clsComboBox
    For intY = 0 To clscombobox(tmpControl).listcount -1
      if lowercase(clscombobox(tmpControl).list(inty))= lowercase(tmpKeyValue)  then
        clscombobox(tmpControl).listindex=inty
        exit for
      end if
    Next
   
  case isa popupmenu
    For intY = 0 To popupmenu(tmpcontrol).listcount -1
      if lowercase( popupmenu(tmpControl).list(inty))= lowercase(tmpKeyValue )then
        popupmenu(tmpControl).listindex=inty
        exit for
      end if
    Next
   
  case isa clsPopupMenu
    For intY = 0 To clspopupmenu(tmpcontrol).listcount -1
      if lowercase( clspopupmenu(tmpControl).list(inty))= lowercase(tmpKeyValue )then
        clspopupmenu(tmpControl).listindex=inty
        exit for
      end if
    Next
   
  end select
 
End Sub