How to save file via iGxDialog

878
2
12-03-2013 04:47 PM
EnzheLu
New Contributor II
I have already write a VB.net code to open a path for .lyr or dataset in disk.
However, I still don't know how to creat a save path through gxDialog.
Moreover, If it is possible, could anyone provide me a short code about how to save table via GxDialog??
I really really appreciate it.
0 Kudos
2 Replies
DuncanHornby
MVP Notable Contributor
Here is some code that gets you the full path to a shapefile that you intend to create:

Dim pEnumGXObject As IEnumGxObject = Nothing
Dim pGXDialog As IGxDialog
pGXDialog = New GxDialogClass
Dim pGxObjectFilter As IGxObjectFilter
pGxObjectFilter = New GxFilterPolylineFeatureClasses
With pGXDialog
      .ObjectFilter = pGxObjectFilter
      .Title = "Set name of merged functional network"
      .RememberLocation = True
      .AllowMultiSelect = False
      .ButtonCaption = "OK"
      .DoModalSave(Me.Handle.ToInt32)
End With


Dim pGXObject As IGxObject
pGXObject = pGXDialog.FinalLocation
Dim s, fp As String
s = pGXDialog.Name
If Microsoft.VisualBasic.LCase(Microsoft.VisualBasic.Right(s, 4)) <> ".shp" Then
   s = s & ".shp"
End If
fp = pGXObject.FullName & "\" & s
0 Kudos
EnzheLu
New Contributor II
Here is some code that gets you the full path to a shapefile that you intend to create:

Dim pEnumGXObject As IEnumGxObject = Nothing
Dim pGXDialog As IGxDialog
pGXDialog = New GxDialogClass
Dim pGxObjectFilter As IGxObjectFilter
pGxObjectFilter = New GxFilterPolylineFeatureClasses
With pGXDialog
      .ObjectFilter = pGxObjectFilter
      .Title = "Set name of merged functional network"
      .RememberLocation = True
      .AllowMultiSelect = False
      .ButtonCaption = "OK"
      .DoModalSave(Me.Handle.ToInt32)
End With


Dim pGXObject As IGxObject
pGXObject = pGXDialog.FinalLocation
Dim s, fp As String
s = pGXDialog.Name
If Microsoft.VisualBasic.LCase(Microsoft.VisualBasic.Right(s, 4)) <> ".shp" Then
   s = s & ".shp"
End If
fp = pGXObject.FullName & "\" & s


Thank you, sir, I have figure it out
0 Kudos