web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

Error "Variable 'xxx' is not found in scope."

(0) ShareShare
ReportReport
Posted on by

Hi, all, 

I am trying to create a new group control in form, and set the control visible via code to make its visibility condition controlled.
But when I tried to set FormGroupControl1.visible(true), the IDE (VS2017) will inform that "Variable 'FormGroupControl1' is not found in scope."

Could anyone help me on this? Why this happen? And how could I set the control visible via code?

Thank you for your time and help.

pastedimage1678551844235v1.png    pastedimage1678552191602v2.png

I have the same question (0)
  • Kai Cheng Profile Picture
    on at
    RE: Error "Variable 'xxx' is not found in scope."

    Thank you, Komi, Mohit and Arunraj. Auto declaration works!

  • Suggested answer
    Arunraj Rajasekar Profile Picture
    1,743 on at
    RE: Error "Variable 'xxx' is not found in scope."

    Hi Kai Cheng,

    Like Komi mentioned, set the auto declaration property on the control to Yes. This will allow you to access the control by code and it will resolve the variable error.

    Answering other part of question, you can alter the visibility of control by code. You are using the right syntax for it.

    Make sure you add code for both visible true and false.

  • Mohit Rampal Profile Picture
    12,563 Moderator on at
    RE: Error "Variable 'xxx' is not found in scope."

    Hi, Are you trying to access this control via code within form or outside in a class? If within form then check Auto declaration property as Komi suggested, however if outside the form then it's different story.

  • Suggested answer
    Komi Siabi Profile Picture
    13,032 Most Valuable Professional on at
    RE: Error "Variable 'xxx' is not found in scope."

    Did you set the Auto declaration property of the form control to Yes ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 180 Super User 2025 Season 2

#2
Yng Lih Profile Picture

Yng Lih 130

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 104 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans