Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to close all layers in Mapinfo except one and again add one layer. How to do so in Mapinfo using Mapbasic or without?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

This will close all layers except one using a layer name to check what to keep open:

Dim i as Integer
Dim tables as Integer
Dim tableName as String

tables = NumTables()

For i = 0 To tables
    tableName = TableInfo(i,TAB_INFO_NAME)
    '' Check to see if the table is anything but the one we are looking for.
    If Not tableName = "{Your table name to check here}" Then
        Close Table tableName 
    End If
Next
share|improve this answer
    
I would like to ask is hiding layer valid way to to change the selection of any query when I am hiding data from master table and only displaying result using query? –  kinkajou Jul 3 '11 at 22:56
    
closing table closes layer but I would like to hide "Display Off" layer and how to get available layers above code would give error if table is present and layer is not added –  kinkajou Jul 4 '11 at 12:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.