Leadtools TWAIN (Leadtools.Twain assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.30
SelectSource Method
See Also 
Leadtools.Twain Namespace > TwainSession Class : SelectSource Method



sourceName
String contains source name to be selected
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
)
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 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also