VERSION 5.00 Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} OsastonValinta Caption = "Osastojen valinta" ClientHeight = 2610 ClientLeft = 45 ClientTop = 435 ClientWidth = 4710 OleObjectBlob = "Luku11 - Lomakkeen kontrollien yhteistyö.frx":0000 StartUpPosition = 1 'CenterOwner End Attribute VB_Name = "OsastonValinta" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub CommCancel_Click() Unload OsastonValinta End Sub Private Sub CommOK_Click() Unload OsastonValinta End Sub Private Function ValintojaKpl() As Long Dim Lp As Long Dim ValKpl As Long ValKpl = 0 For Lp = 1 To Me.ListBox1.ListCount If Me.ListBox1.Selected(Lp - 1) Then ValKpl = ValKpl + 1 End If Next Lp ValintojaKpl = ValKpl End Function Private Sub LomakkeenVirkistys() Me.TextBox1.Text = ValintojaKpl If Me.TextBox1.Text > 0 And _ Me.TextBox1.Text < 4 Then Me.CommOK.Enabled = True Else Me.CommOK.Enabled = False End If End Sub Private Sub ListBox1_Change() Call LomakkeenVirkistys End Sub Private Sub UserForm_Initialize() For Lp = 1001 To 1012 Me.ListBox1.AddItem "Osasto " & Lp Next Me.ListBox1.MultiSelect = fmMultiSelectMulti Me.TextBox1.Enabled = False Me.CommOK.Enabled = False End Sub