Private Sub FKeyButton_Click(Index As Integer)
Dim curChild As Form
Set curChild = frmMain.ActiveForm
Dim funcStr As String
Dim funcStrA(3) As String
funcStrA(0) = "F"
funcStrA(1) = str(Index)
funcStrA(2) = "_Click"
funcStr = Join(funcStrA, "")
If ExistsFunction(funcStr, curChild) Then
CallByName curChild, funcStr, VbMethod
End If
End Sub
The result should be, that a function in the actual mdichild is called, when a button is clicked.
for example the button with the index ‘7’ is clicked, the String ‘funcStr’ should have the value “F7_Click”.
But the value is “F 7_Click”, and the existfunction returns false.
I think the problem is within the join, but i also tried to trim, but there is no effect.
Actually, if I recall correctly, it’s the
Str()function. It prepends a space as a placeholder for the sign. UseCStr()or just assign theIndexdirectly tofuncStrA(1)and let it get implictly converted to a string.