Mike, You have a variable called "gnWinId" that should hold the ID of the Map. Appearently you have assigned any value to this variable as it is zero (0).
You need to assigned the ID of the FrontWindow() (if it is a map window) or any map window. This can be done with this command: '**Asumming that the active window is a map gnWinId = FrontWindow() HTH, Peter Horsb�ll M�ller GIS Developer Geographical Information & IT COWI A/S Odensevej 95 DK-5260 Odense S. Denmark Tel +45 6311 4900 Direct +45 6311 4908 Mob +45 5156 1045 Fax +45 6311 4949 E-mail [EMAIL PROTECTED] http://www.cowi.dk/gis -----Original Message----- From: Mayer, Mike @ Vancouver [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 7:11 PM To: '[email protected]' Subject: MI-L MapBasic Geocoding Hello Everyone, I am GIS student working on a custom application. I am trying to automate a geocoding task in MapBasic v4.5 and continually get the same error. I can't figure out what the problem is and have tried numerous things. I am hoping someone can give me a little insight here. My code for the sub is below. The error I receive is: invalid window identifier:0, it occurs at the line highlighted below: Sub GeocodeTest Dim fx, fy as float '******************************* '* Set for finding the address '******************************* Find Using BCrds(street) Find "2419 Marine Drive" Interactive '****************************** '* If found, position the map. '****************************** If (CommandInfo(CMD_INFO_FIND_RC) >=1) Then fx = CommandInfo(CMD_INFO_X) fy = CommandInfo(CMD_INFO_Y) Set Map Layer retailcomps_GC Editable On Insert Into retailcomps_GC (obj) Values(CreatePoint(fx,fy)) Set Map Window gnWinId ---> Center (fx, fy) <------ Zoom 1 Units "mi" AutoLabel Layer retailcomps_GC Else Note "Address not found." End If End Sub I am currently running MapInfo version 7.8. Thanks in advance for any help! Mike Mayer --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 16021 --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 16023
