'We assume that the GdViewer1 control has been properly integrated.
Using dialog As FolderBrowserDialog = New FolderBrowserDialog()
dialog.Description = "Select the folder for opening your files."
dialog.ShowNewFolderButton = False
dialog.RootFolder = Environment.SpecialFolder.Desktop
If dialog.ShowDialog() = DialogResult.OK Then
Dim folder As String = dialog.SelectedPath
Dim fileName As String = ""
For Each fName As String In Directory.GetFiles(folder, "*.*", SearchOption.TopDirectoryOnly)
If GdViewer1.DisplayFromFile(fName) = GdPictureStatus.OK Then
Dim result As DialogResult = MessageBox.Show("Next file?", "GdViewer.CloseDocument", MessageBoxButtons.YesNo)
If result = DialogResult.No Then
fileName = fname
'The viewer will not clear after closing the document.
GdViewer1.CloseDocument(true)
Exit For
Else
'The viewer will clear after closing the document.
GdViewer1.CloseDocument()
End If
End If
Next
'Do your stuff with fileName.
End If
End Using
//We assume that the GdViewer1 control has been properly integrated.
using (FolderBrowserDialog dialog = new FolderBrowserDialog())
{
dialog.Description = "Select the folder for opening your files.";
dialog.ShowNewFolderButton = false;
dialog.RootFolder = Environment.SpecialFolder.Desktop;
if (dialog.ShowDialog() == DialogResult.OK)
{
string folder = dialog.SelectedPath;
string fileName = "";
foreach (string fName in Directory.GetFiles(folder, "*.*", SearchOption.TopDirectoryOnly))
{
if (GdViewer1.DisplayFromFile(fName) == GdPictureStatus.OK)
{
DialogResult result = MessageBox.Show("Next file?", "GdViewer.CloseDocument", MessageBoxButtons.YesNo);
if (result == DialogResult.No)
{
fileName = fName;
//The viewer will not clear after closing the document.
GdViewer1.CloseDocument(true);
break;
}
else
{
//The viewer will clear after closing the document.
GdViewer1.CloseDocument();
}
}
}
//Do your stuff with fileName.
}
}