Leadtools.Twain Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.8.31
SelectSource Method
See Also  Example
Leadtools.Twain Namespace > TwainSession Class : SelectSource Method




sourceName
String contains source name to be selected
Displays the TWAIN dialog box to be used to select a TWAIN source for acquiring images.

Syntax

Visual Basic (Declaration) 
Public Function SelectSource( _
   ByVal sourceName As String _
) As DialogResult
Visual Basic (Usage)Copy Code
Dim instance As TwainSession
Dim sourceName As String
Dim value As DialogResult
 
value = instance.SelectSource(sourceName)
C# 
public DialogResult SelectSource( 
   string sourceName
)
Managed Extensions for C++ 
public: DialogResult SelectSource( 
   string* sourceName
) 
C++/CLI 
public:
DialogResult SelectSource( 
   String^ sourceName
) 

Parameters

sourceName
String contains source name to be selected

Return Value

One of the DialogResult values.
If an error occurs, an exception is thrown.

Example

Visual BasicCopy Code
Public Sub SelectSourceExample(ByVal parent As IWin32Window)
   Dim session As TwainSession = New TwainSession()
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None)

   If session.SelectSource(String.Empty) <> DialogResult.OK Then
      MessageBox.Show("Error Selecting Source")
   End If

   session.Shutdown()
End Sub
C#Copy Code
public void SelectSourceExample(IWin32Window 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"); 
 
   session.Shutdown(); 
}

Remarks

For more information, refer to Managing the TWAIN Source.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also