loading table into toc

445
2
11-16-2010 08:41 AM
EugeneDerner
New Contributor
Folks,

I am not having luck finding code snippets to do this in C#.   I have gotten this far...

// open text file as a table
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
ITable table featureWorkspace.OpenTable("potshots.txt");

IStandaloneTable pStTab = new StandaloneTable();
pStTab.Table = table;




I get stuck here.  Yes, I am converting VBA code and maybe I am going about this all wrong.  Any pointers would be greatly appreciated.  Thanks!

Ultimately I want to join this table to a shapefile I have loaded in the project.
0 Kudos
2 Replies
NeilClemmons
Regular Contributor III
You've opened the table and created a new standalone table so all that's left is to add it to the map.  To do that, get a reference to the map (IMap) and QI over to IStandaloneTableCollection.  Call AddStandAloneTable and pass in your standalone table.  Also, having the table in the map's table collection isn't necessary in order to perform a table join so if that's the only reason you're adding it then you may want to skip it altogether.
0 Kudos
EugeneDerner
New Contributor
Also, having the table in the map's table collection isn't necessary in order to perform a table join so if that's the only reason you're adding it then you may want to skip it altogether.


good point...thanks...i will skip it.
0 Kudos