Discussion created by sergiy2001 on May 27, 2011
Latest reply on May 30, 2011 by sergiy2001

My goal is to have a db trigger that creates a view in a sql server db. I then want to add that view as a table to the page layout.

I've been working with the TableFrameClass (via a sample on the forums) and can get the table added just fine, however, I'd like to be able to control the width of the columns.

As you can see below I've been trying to use the ITableProperty.set_FieldWidth() method but it doesn't work!!!
I checked ITableProperty.get_FieldWidth() and it always return 0. Does anyone know what's wrong with that class?

IMxDocument pMxDoc = (IMxDocument)(m_application.Document);
                IPageLayout pPageLayout = pMxDoc.PageLayout;
                IGraphicsContainer pGcontainer = (IGraphicsContainer)pPageLayout;
                IMap m_pMap = pMxDoc.FocusMap;
                pMxDoc.ActiveView = (IActiveView)pMxDoc.PageLayout;
                IFeatureLayer pLayer = (IFeatureLayer)m_pMap.get_Layer(0);
                ITable pTable = (ITable)pLayer.FeatureClass;
                ITableFrame pTableFrame = new TableFrameClass();
                IElement pElement = (IElement)pTableFrame;
                pTableFrame.Table = pTable;               
                pTableFrame.StartCol = 0;
                pTableFrame.StartRow = 0;

                ITableProperty pP = new TablePropertyClass();
                pP.Table = pTable;
                int x = pP.get_FieldWidth("Nazva");
                x = pP.get_FieldWidth("OBJECTID");
                x = pP.get_FieldWidth("fuckaskdl");
                x = (pP as TablePropertyClass).ITableProperty2_get_FieldWidth("Nazva");
                x = (pP as TablePropertyClass).ITableProperty3_get_FieldWidth("Nazva");
                x = (pP as TablePropertyClass).ITableProperty2_get_FieldWidth("OBJECTID");
                x = (pP as TablePropertyClass).ITableProperty3_get_FieldWidth("OBJECTID");

x is always 0.
m_pMap.get_Layer(0) always in the project.
thanks in advance