---
title: "MediaFormatManager..::.CreateFormatReader Method (String)"
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_MediaFormatManager_CreateFormatReader_1_bb3a7a4f.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# MediaFormatManager.CreateFormatReader Method (String)
 
Creates and initializes a new [IFormatReader](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_IFormatReader.htm.md) class instance, opening the specified file.
 
**Namespace:** [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
 **Assembly:** Aurigma.GraphicsMill.Codecs.MediaProcessor (in Aurigma.GraphicsMill.Codecs.MediaProcessor.dll)
 
## Syntax
  
```
Public Shared Function CreateFormatReader ( _filename As String _
) As IFormatReader
```
 
```csharp
public static IFormatReader CreateFormatReader(string filename
)
```
 
### Parameters
 
 - filename
     - Type: [System.String](http://msdn2.microsoft.com/en-us/s1wwdcbf)
Full path to the file to open.
 
### Return Value
An object of the [IFormatReader](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_IFormatReader.htm.md) type.
 
## Examples
 This example shows how to create a reader. ```
'Create a reader using the class factory
Private Sub CreateReader(ByVal fileName As String)
    Try
        reader = MediaFormatManager.CreateFormatReader(fileName)
    Catch ex As System.Exception
        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, _
            MessageBoxIcon.Error)
    End Try
End Sub
``````csharp
//Create a reader using the class factory
private void CreateReader(String fileName)
{
    try
    {
        reader = MediaFormatManager.CreateFormatReader(fileName);
    }
    catch(System.Exception ex)
    {
        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
            MessageBoxIcon.Error);
    }

}
```
   
## See Also

### Reference

- [MediaFormatManager Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_MediaFormatManager.htm.md)
- [CreateFormatReader Overload](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Codecs_MediaFormatManager_CreateFormatReader.htm.md)
- [Aurigma.GraphicsMill.Codecs Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
