This property sets the file type initially displayed by the OpenFileDialog and SaveFileDialog methods.

[Visual Basic]
Public Property FileExtension As String
[C#]
public string FileExtension {get; set;}

Property Value

The FileExtension is the file type (i.e. jpg, bmp)

Explanation

The FileExtension property sets the file type initially displayed by the OpenFileDialog and SaveFileDialog methods.

When you execute the OpenFileDialog and SaveFileDialog methods, the "Open" dialog box and "Save" dialog box will be displayed. The FileExtension property sets which file extentions will be listed in the "Files of type" drop down menu at the bottom of the dialog box.

By default the "Open" dialog box and the "Save" dialog box display all file types in a given folder. They also display the term "All Files" along with all image file extentions supported by the ImageKit in the "Files of type" drop down menu at the bottom of the dialog box. By setting the FileExtension property, you can determine which file extentions will be listed in the "Files of type" drop down menu and thereby influence the types of files that will be displayed in the "Open" dialog box and "Save" dialog box.

To set the FileExtension property, start with the file explanation followed by a "|" symbol as a delimeter and the the file extensions to be displayed. When listing multiple file extensions, use a comma (;) to delimit them. If an empty string ("") is set into the FileExtension property then the file types will be "all files". If an empty string is set into the FilePath property, then the current direct directory will be displayed when the dialog opens.

There is no distinction made between upper case or lower case letters so that "BMP" is treated as the same as "bmp".

Example

The code below illustlates how to set the default folder to "C:\Images" and to set the file types to "BMP", "JPG and PNG", and "All Files":

[Visual Basic.NET]
Dim Ik_File As Newtone.ImageKit.IkFile

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
  Ik_File = New Newtone.ImageKit.IkFile
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  Dim fname As String

  Ik_File.FilePath = "c:\images"
  Ik_File.FileExtension = "Bitmap Files|*.bmp|Jpeg,Png Files|*.jpg;*.png|All Files|*.*"
  fname = Ik_File.OpenFileDialog()
  PictureBox1.Image = New Bitmap(fname)
End Sub

[Visual C#.NET]
private Newtone.ImageKit.IkFile Ik_File;

private void Form1_Load(object sender, System.EventArgs e)
{
  Ik_File = new Newtone.ImageKit.IkFile();
}

private void button1_Click(object sender, System.EventArgs e)
{
  Ik_File.FilePath = "c:\\Images";
  Ik_File.FileExtension = "Bitmap Files|*.bmp|Jpeg,Png Files|*.jpg;*.png|All Files|*.*";
  string fname = Ik_File.OpenFileDialog();
  pictureBox1.Image = new Bitmap(fname);
}

See Also

IkFile Class | IkFile Members

The ImageKit.NET3 is created by Newtone Corporation