Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: [V8i VBA] How to determine a form control's object name?

$
0
0

Hi Barry,

I have not too much experience with VBA Forms and maybe it's the reason why your approach looks a bit strange to me ;-)

I see no reason to work with controls names, because it's automatically something hard coded and consequently risky. Can to pass the control's reference as a parameter help you?

Private Sub TB_CustomRed_Change()
    ValidateRgb Me.TB_CustomRed
End Sub

Private Sub ValidateRgb(tBox As textBox)
    If (IsNumeric(tBox.Value) And vbNullString <> tBox.Value) Then
        '...
    End If
End Sub

It allows to implement several common subs used to process control change events and to don't mention their names at all. The only recommendation is to have own subs per control type, so it's not required to test the control type and if a specific property or method exist.

With regards,

 Jan


Viewing all articles
Browse latest Browse all 7260


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>