The System.Windows.Forms.ListBox Focus property allows developers to set or get the focus of a ListBox control in a Windows Forms application. Setting focus on a ListBox control can be useful when users interact with an application using the keyboard.
Example 1: To set the focus on a ListBox control named listBox1, use the following code:
listBox1.Focus();
Example 2: To check if a ListBox control named listBox1 has focus, use the following code:
if (listBox1.Focused)
{
// Do something if ListBox has focus
}
These examples are part of the System.Windows.Forms namespace in the .NET Framework Class Library.
C# (CSharp) System.Windows.Forms ListBox.Focus - 24 examples found. These are the top rated real world C# (CSharp) examples of System.Windows.Forms.ListBox.Focus extracted from open source projects. You can rate examples to help us improve the quality of examples.