This document is archived and information here might be outdated.  Recommended version.


IWorkspaceFactory.OpenFromFile Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (GeoDatabase)  

IWorkspaceFactory.OpenFromFile Method

Opens the workspace specified by the given file name.

[Visual Basic .NET]
Public Function OpenFromFile ( _
    ByVal fileName As String, _
    ByVal hWnd As Integer _
) As IWorkspace
[C#]
public IWorkspace OpenFromFile (
    string fileName,
    int hWnd
);
[C++]
HRESULT OpenFromFile(
  BSTR fileName,
  long hWnd,
  IWorkspace** Workspace
);
[C++]

Parameters fileName [in] fileName is a parameter of type BSTR hWnd [in] hWnd is a parameter of type long Workspace [out, retval]
Workspace is a parameter of type IWorkspace

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

OpenFromFile takes the pathname of a file or directory that represents either a FileSystemWorkspace or LocalDatabaseWorkspace, or a connection file to a RemoteDatabase workspace and returns an interface on the specified workspace. Clients of these methods can then proceed to open and access datasets in the workspace. If these methods are called with insufficient properties, then the user will be presented with a connection dialog that will prompt for the required properties.

The hWnd argument is the parent window or application's window. The hWnd will guarantee that the connection dialog, if presented to you because of insufficient properties, has the correct parent.

See Also

IWorkspaceFactory Interface

.NET Snippets

Set Data Source | Get FeatureClass From Shapefile On Disk | Add Tracking Layer To Map | Create Grid From Feature Class

.NET Samples

Closest facility solver (Code Files: frmClosestFacilitySolver) | Add a custom menu created in .NET to ArcGIS for Desktop (Code Files: AddShapefile) | Cut polygons without selection edit task (Code Files: EditingForm) | Custom reshape polyline edit task (Code Files: EditingForm) | 3D dynamic element tracking (Code Files: TrackDynamicObject) | Service area solver (Code Files: frmServiceAreaSolver) | Managing snap agents (Code Files: EditingForm) | Create a custom raster type (Code Files: TestThumbnailBuilder) | Location-allocation solver (Code Files: frmLocationAllocationSolver) | Vehicle routing problem solver (Code Files: frmVRPSolver) | Automate ArcGIS for Desktop applications (Code Files: Form1) | Simple point plug-in data source (Code Files: OpenSimplePointDlg) | Origin-destination cost matrix solver (Code Files: frmODCostMatrixSolver) | Create a custom raster type from the ground up for DMCII data (Code Files: DMCIIRasterType) | Extending the replication synchronization process (Code Files: RegisterExtension) | Publish an image service and set configurations (Code Files: ISConfig) | Custom vertex editing commands (Code Files: EditingForm) | Create a Math Function Raster dataset (Code Files: CreateMathFunctionRasterDataset) | RSS weather GraphicTracker (Code Files: RSSWeather) | Bind a geodatabase table to a .NET control (Code Files: MainWind) | Buffer snap agent (Code Files: EditingForm) | Mosaic raster datasets to a file raster format (Code Files: CreateFileRasterMosaic) | Get and set key properties on a mosaic dataset (Code Files: GetSetKeyProperty) | RSS weather layer (Code Files: RSSWeatherLayerClass) | Create a custom NoData pixel filter (Code Files: TestApp) | Add and symbolize a historical temporal layer in ArcMap (Code Files: AddTemporalLayerButton) | Create an NDVI custom raster function (Code Files: NDVICustomFunction TestNDVICustomFunction) | Create a Function Raster dataset (Code Files: CreateFunctionRasterDataset) | Route layer (Code Files: Program) | Edit event listener (Code Files: EditingForm) | Create a custom raster function (Code Files: TestWatermarkFunction WatermarkFunction) | Play back tracking data (Code Files: PlaybackDataButton)

.NET Related Topics

Accessing ECWP service | Accessing raster workspaces | Adding a custom menu created in .NET to ArcGIS for Desktop | Adding a plug-in data source programmatically | Automating ArcGIS for Desktop applications | Connecting to geodatabases and databases | Converting data using GeoAnalyst objects | Creating an address locator | Data processing in spatial analysis operations | DataSourcesOleDB | DataSourcesRaster | Executing a map algebra expression | Geodatabase | How to access a raster dataset | How to access members that control the CAD drawing dataset | How to add different types of layers to a map | How to change label formats and marks on an axis using a line graph | How to create a 3D pie graph | How to create a box plot graph | How to create a dynamic geocoded feature class | How to create a function series graph | How to create a histogram graph | How to create a Mosaic dataset | How to create a mosaic layer | How to create a multimodal network dataset | How to create a network dataset | How to create a raster dataset | How to create a selection set using a scatter plot graph | How to create a vertical stack area graph | How to create an image server layer | How to create graph series with different color types | How to create multiple vertical bar graphs | How to export a dataset to XML | How to geocode a single address | How to geocode a table of addresses | How to get CAD transformation properties (from, to, angle, and scale) | How to get the points of a two-point CAD transformation | How to import a dataset from XML | How to open a Mosaic dataset | How to open a terrain dataset | How to open locator workspaces | How to return CAD drawing layer properties | How to return CAD transformation settings | How to save a function raster dataset into a raster dataset | How to save a mosaic dataset to a raster dataset | How to save raster data and set storage properties | How to set CAD transformation properties (from, to, angle, and scale) | How to set the points of a two-point CAD transformation | How to sort data in the graph | How to work with geocoding properties | Location | Performing a spatial analysis operation using objects | Working with the analysis environment