שתף באמצעות


Get current form name

Question

Monday, February 23, 2015 1:59 PM

I thought this would have been easier. I want to retrieve the name of the current form (the one I just entered). Short of passing the form name as a parameter from the parent form is there an easy way.

I tried

Me.ActiveForm

Form.ActiveForm

Any ideas?

John

All replies (3)

Monday, February 23, 2015 2:05 PM ✅Answered | 1 vote

Me.Name ?

or

        Dim currentForm As Form = Form.ActiveForm
        MessageBox.Show(currentForm.Name)

Monday, February 23, 2015 2:10 PM ✅Answered | 1 vote

If you are inside some procedure of the form, then try Me.GetType.Name too. It depends on details, perhaps the problem can be solved differently without these strings.


Monday, February 23, 2015 2:15 PM

Many thanks to both of you. It works.