# FIX: #REGION Directive Not Behaving Properly in FoxPro 2.6x

ID: Q117352

    2.6x    | 2.6x

WINDOWS | MS-DOS

     kbprg kbfixlist kbbuglist

The information in this article applies to:

- Microsoft FoxPro for Windows, versions 2.6x
- Microsoft FoxPro for MS-DOS, versions 2.6x

## SYMPTOMS

If you use the #REGION compiler directive in conjunction with the REGIONAL command in order to use a variable that has the same name but has different values in a single screen, the #REGION directive does not work correctly.

## STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual FoxPro 3.0 for Windows.

## MORE INFORMATION

The REGIONAL command creates regional memory variables and arrays. Memory variables or arrays with identical names can be created without interfering with each other when their values are protected within a "region." Regional variables are similar to private variables.

Regional variables are declared before they are used in a screen. A region (0 through 31) is created with the #REGION compiler directive. Then the command REGIONAL <variable name> is used after the #REGION directive.

### Steps to Reproduce Problem

1. Place the following code in the Setup code section of a screen:

          #REGION 1
          REGIONAL abc
          abc = "This is region 1."

          #REGION 2
          REGIONAL abc
          abc = "This is region 2."

2. Create a push button with the following code in the VALID clause:

          #REGION 1
          WAIT WINDOW abc

3. Create another push button with the following code in the VALID clause:

          #REGION 2
          WAIT WINDOW abc

When you click the first push button, the text "This is region 1." should appear. Instead, the text "This is region 2." appears because GENSCRN does not generate the #REGION directives properly--the variable "abc" is recognized only once with the text that was assigned to it last. The same code works correctly in FoxPro version 2.5 for Windows and MS-DOS.

Additional reference words: FoxDos FoxWin VFoxWin 2.60 2.60a fixlist3.00 buglist2.60 buglist2.60a KBCategory: kbprg kbfixlist kbbuglist KBSubcategory: FxtoolSbuilder

    Keywords          : kbenv FxtoolSbuilder kbbuglist kbfixlist
    Version           : 2.6x | 2.6x
    Platform          : MS-DOS WINDOWS
    Solution Type     : kbfix

Last Reviewed: May 14, 1998 © 1999 Microsoft Corporation. All rights reserved. Terms of Use.