Kyung-After [INDENT]pTableProperty.FieldOrder = "OBJECT_ID, UFI, MF, NT, UNI, LAT, LONG" [/INDENT]you need to do this...[INDENT]pTableWindow.Refresh() 'necessary to show the new FieldOrder [/INDENT]Also, your comma-delimited list has spaces after each comma; mine does not; not sure if that's an issue.Good luck!
Kyung-When you say "it didn't work", is your code finishing with no errors, and when you open the table, the field order is unchanged?Do you have any errorhandling in your VBA code to catch errors???For example:Public Sub ChangeFieldOrder()On Error GoTo Errorhandler<your code here> Exit Sub 'exit before errorhandlerErrorhandler: MsgBox "An error occurred in ChangeFieldOrder:" & Err.Description, vbCritical, "ChangeFieldOrder"End Sub
Kyung-I don't know what could be wrong. If you re-post the latest version of your code, maybe something will hit me. I tried this in VBA a couple years ago and gave up, so I share your frustration. Just got it working in ArcGIS 10, .NET, VS2010.2 more things you could try:1. set the .Application property before anything else:[INDENT]Set pTableWindow.Application = ApplicationSet pTableWindow.FeatureLayer = pFeatureLayer[/INDENT]2. verify that you have the TableProperty for the correct Featurelayer, check it's FieldOrder before, and again after you reset it: [INDENT]' Re-order the fieldsDebug.Print("TableProperty FeatureLayer: " & pTableProperty.FeatureLayer.Name)Debug.Print("TableProperty Original FieldOrder: " & pTableProperty.FieldOrder)pTableProperty.FieldOrder = "OBJECT_ID, UFI, MF, NT, UNI, LAT, LONG"Debug.Print("TableProperty Revised FieldOrder: " & pTableProperty.FieldOrder)[/INDENT]The newer interfaces, ITableWindow2 and ITableWindow3, take an iLayer instead if iFeatureLayer; I think those were added in 9.3 and 10.0.
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.