FileNavigator Advance Method CleanCode C# Libraries v1.2.03 API
Advances the FileNavigator to the preceding or following file, depending upon the specified OnlineIComparer.

Namespace: CleanCode.IO
Assembly: CleanCode (in CleanCode.dll) Version: (1.2.03)

public int Advance(
	IComparer comparer

Return Value

0 if successful, -1 if no directory selected, -2 if no files found, or -3 if the current file is not found (in which case the first file in the directory will be returned).

Locates the currently selected file name from the OnlineComboBox and goes to the "next" file, where the next one is typically the the preceding one or the following one, depending on the comparer. The progression wraps around either end of the list of files in the current directory.

This example shows how to instrument previous and next buttons on a Windows form.
private void prevFileButton_Click(object sender, EventArgs e)
    fileNavigator.Advance(new CleanCode.IO.DateComparerAscending());

private void nextFileButton_Click(object sender, EventArgs e)
    fileNavigator.Advance(new CleanCode.IO.DateComparerDescending());
See Also