Create a new geodatabase dataset (VB)

Description:

This sample will demonstrate the steps needed to create a new geodatabase dataset. The function does not require that the spatial reference be supplied, however it is recommended that the appropriate spatial reference is used when creating data.

How to use:
  1. Paste the code into your VB or VBA Application.
  2. Call the function from within your application.
Public Function createDataset(Name As String, workspace As esriCore.IWorkspace, _
                 Optional pSR As esriCore.ISpatialReference) As esriCore.IFeatureDataset
'' createDataset:  creates a dataset in a workspace
'' ISpatialReference is optional but should generally be defined by the caller
''
  Dim pFeatureWorkspace As esriCore.IFeatureWorkspace
  On Error GoTo EH
  
  Set createDataset = Nothing
  If workspace Is Nothing Then Exit Function
  
  ' if the spatial reference is not passed in, then create an unknown one here
  If (pSR Is Nothing) Or IsMissing(pSR) Then
    Set pSR = New esriCore.UnknownCoordinateSystem
    pSR.SetDomain 0, 21474.83645, 0, 21474.83645
    pSR.SetFalseOriginAndUnits 0, 0, 100000
    pSR.SetMDomain 0, 21474.83645
    pSR.SetZDomain 0, 21474.83645
    pSR.SetZFalseOriginAndUnits 0, 100000
  End If
  
  Set pFeatureWorkspace = workspace
  
  ' create the feature dataset
  Set createDataset = pFeatureWorkspace.CreateFeatureDataset(Name, pSR)
  
  Exit Function
EH:
    MsgBox Err.Description, vbInformation, "createDataset"
End Function