Eagle, David A [SMTP:[EMAIL PROTECTED]] wrote:

> > I'm currently writing a small application. I am using FileOpenDlg to
> > navigate to a *.Tab file, I then want update an EditText box with that
> > table
> > name. I can manage to update it with the path but I don't want to show
the
> > full path, only the file name. I've included the snippet of code
below...
> >
> > To strip out the filename only I am trying to search for the first "\"
> > from
> > the right of the string, but I'm sure I am barking up the wrong tree, as
> > all
> > sTab_Name is feeding me so far is "TAB"?!

"Driver, Greg 9434" <[EMAIL PROTECTED]> replied:

> Can't you use PathToFileName$() function?  This returns a filename given a
> file specification as in:
>
> sTab_name = PathToFileName$(sTab_Path)

You can't rely on PathToTableName$() to return the name of the table
that a given .TAB file path will open under.

The best solution is to open the table and read the name.

Thus:

>> Sub Browse_Open
>> Dim sTab_Path As String
>> Dim sTab_Name As String
>> sTab_Path = FileOpenDlg("C:\","","TAB","Open Gazetteer Table")
if sTabPath = ""
   then exit sub
end if
OnError goto oops
open table sTabPAth
sTabName = TableInfo (0, TAB_INFO_NAME)
OnError goto 0
>> Print sTab_Path
>> Print sTab_Name
>> Alter Control 900 Value sTab_Path
exit sub
oops: reume failed
failed: exit sub
>> End Sub

Hope this helps,
Spencer



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to