私はあなたの助けが必要です。私は、コレクション内のクラス値を変更し、 "変数"を変更したい。編集値のコレクション - 変数機能...(?)
cAdmin = xy
cCheckDate=yz
cPruefState= abc
colSomeName.add Classname, key1
これをコレクション(colSomeName)に保存します。フォーム上で、イベントが発生すると、コレクションのキーが検索され、現在の値が変更されます。私は、(例えば)の値を設定し、クラスで
Sub CheckOut()
..
editInCollection colSomeName, „StackOver“
. . .
Public Function editInCollection(_
ByRef col As Collection, _
ByRef Elem As String) As Boolean
On Error GoTo Ende
If IsEmpty(col(Elem)) Then
MsgBox " This Element: " & col(Elem) & „ not exits!", _
vbCritical = vbOKOnly, "s o r r y "
Exit Function
End If`enter code here`
IsInCollection = (Err.Number = 0)
'
col(Elem).cAdmin =Environ("username")
col(Elem).cCheckDate = Date
col(Elem).cPruefState= True
'
Exit Function
Ende:
IsInCollection = False
End Function
それは完璧に動作します。 しかし、私は異なるクラス/コレクションのためのfunkionを使用したいと思います。 これはpossipleですか? 私idearは
このようなPublic Function editInCollection(_
ByRef col As Collection, _
ByRef Elem As String, clsValue as Variant(?), newValue as variant) As Boolean
Dim as ….
For each xAll in col(Elem)
If xAll = clsValue then
clsVlaue = newValue
end if
exit for
next
end function
ですが、私は動作しません。どのように私はこの
あなたの例(一番上のスニペット)をもう少し具体的に編集できますか? IMOあなたがしようとしていることとその理由を理解することは難しいです。 –