public DialogResult SelectSource(
String contains source name to be selected
One of the DialogResult values. If an error occurs, an exception is thrown.
This method checks if the currently selected twain data source is TWAIN 2.x compliant or not, if not then it will load TWAIN 1.x data source manager (Twain_32.DLL) from your system and in this case the used twain version will be TwainVersion1, but if the selected data source is TWAIN 2.x compliant then TWAIN 2.x data source manager (TWAINDSM.DLL) will be loaded from your system and this case the used twain version will be TwainVersion2. This checking will be done ONLY if the SetVersion method was NOT called by the user. You can get the currently selected Twain version by calling GetVersion method. TWAIN 2.x data source manager (TWAINDSM.DLL) is always preferable if the selected data source is TWAIN 2.x compliant, so if for example you have two TWAIN drivers installed on your machine, one of them is TWAIN 2.x compliant while the other is not and you where using the TWAIN 1.x data source (driver) then you called this method and selected the other TWAIN 2.x compliant data source (driver) then LEADTOOLS will internally try to load TWAINDSM.DLL instead of Twain_32.dll in order to use TWAIN 2.x data source manager since your newly selected device is TWAIN 2.x compliant and here you might notice that the data sources listed inside the manufacturer's select source dialog are different depending on the selected TWAIN version. For more information, refer to Managing the TWAIN Source.
public void SelectSourceExample(IntPtr parent)
TwainSession session = new TwainSession();
session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None);
if (session.SelectSource(string.Empty) != DialogResult.OK)
MessageBox.Show("Error Selecting Source");