home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / dispatch / form2.frm < prev    next >
Text File  |  1993-08-31  |  4KB  |  154 lines

  1. VERSION 2.00
  2. Begin Form Form2 
  3.    BackColor       =   &H00FFFF80&
  4.    Caption         =   "Form2"
  5.    ClientHeight    =   3915
  6.    ClientLeft      =   6735
  7.    ClientTop       =   2700
  8.    ClientWidth     =   3885
  9.    Height          =   4320
  10.    Left            =   6675
  11.    LinkTopic       =   "Form2"
  12.    ScaleHeight     =   3915
  13.    ScaleWidth      =   3885
  14.    Top             =   2355
  15.    Width           =   4005
  16.    Begin TextBox dispatcher 
  17.       Height          =   285
  18.       Index           =   0
  19.       Left            =   360
  20.       TabIndex        =   5
  21.       Text            =   "dispatcher"
  22.       Top             =   2400
  23.       Visible         =   0   'False
  24.       Width           =   1395
  25.    End
  26.    Begin TextBox ret 
  27.       BackColor       =   &H00FFFFFF&
  28.       Height          =   285
  29.       Left            =   2040
  30.       TabIndex        =   0
  31.       Text            =   "Text1"
  32.       Top             =   1380
  33.       Width           =   1155
  34.    End
  35.    Begin CommandButton Command1 
  36.       Caption         =   "Exit"
  37.       Height          =   495
  38.       Left            =   2520
  39.       TabIndex        =   1
  40.       Top             =   3240
  41.       Width           =   1155
  42.    End
  43.    Begin Label arg 
  44.       BackStyle       =   0  'Transparent
  45.       BorderStyle     =   1  'Fixed Single
  46.       Caption         =   "Label3"
  47.       DataField       =   "Name"
  48.       DataSource      =   "BankCtrl"
  49.       Height          =   240
  50.       Left            =   2040
  51.       TabIndex        =   4
  52.       Top             =   780
  53.       Width           =   1155
  54.    End
  55.    Begin Label Label2 
  56.       Alignment       =   1  'Right Justify
  57.       BackStyle       =   0  'Transparent
  58.       Caption         =   "Argument:"
  59.       Height          =   240
  60.       Left            =   960
  61.       TabIndex        =   6
  62.       Top             =   780
  63.       Width           =   945
  64.    End
  65.    Begin Label Label1 
  66.       Alignment       =   1  'Right Justify
  67.       BackStyle       =   0  'Transparent
  68.       Caption         =   "Enter return value:"
  69.       Height          =   240
  70.       Left            =   240
  71.       TabIndex        =   3
  72.       Top             =   1440
  73.       Width           =   1695
  74.    End
  75.    Begin Label subname 
  76.       AutoSize        =   -1  'True
  77.       BackColor       =   &H00FFFF80&
  78.       Caption         =   "Label1"
  79.       FontBold        =   -1  'True
  80.       FontItalic      =   0   'False
  81.       FontName        =   "MS Sans Serif"
  82.       FontSize        =   12
  83.       FontStrikethru  =   0   'False
  84.       FontUnderline   =   0   'False
  85.       Height          =   300
  86.       Left            =   480
  87.       TabIndex        =   2
  88.       Top             =   300
  89.       Width           =   825
  90.    End
  91. End
  92. Option Explicit
  93.  
  94. Sub Command1_Click ()
  95.  
  96.     Dim retval
  97.  
  98.     retval = ret        ' get the return value
  99.     Unload form2
  100.     Call dispatchReturn(retval)
  101.  
  102. End Sub
  103.  
  104. Sub dispatcher_Change (index As Integer)
  105.     
  106.     ' dispatcher(0) = name of the sub
  107.     ' dispatcher(1) = first argument
  108.     ' dispatcher(2) = second arguent
  109.     ' ...
  110.     ' dispatcher(n) = n-th  argument
  111.  
  112.     If index <> 0 Then  ' do nothing until we have the the name of the sub
  113.         Exit Sub
  114.     End If
  115.  
  116.     Select Case dispatcher(0)
  117.         Case "Sub1"
  118.             Call sub1(dispatcher(1))
  119.         Case "Sub2"
  120.             Call sub2(dispatcher(1))
  121.     End Select
  122.     
  123. End Sub
  124.  
  125. Sub Form_Load ()
  126.  
  127.     ' init the dispatcher to handle one argument
  128.     
  129.     Load dispatcher(1)
  130.  
  131.     ret = 0
  132.  
  133.  
  134. End Sub
  135.  
  136. Sub sub1 (sarg)
  137.  
  138.     subname = "sub1 called"
  139.     arg = sarg
  140.  
  141.     Show
  142.  
  143. End Sub
  144.  
  145. Sub sub2 (sarg)
  146.  
  147.     subname = "sub2 called"
  148.     arg = sarg
  149.  
  150.     Show
  151.  
  152. End Sub
  153.  
  154.