Create 'Find' Form With Visual Basic 2005 and .NET Win Forms BindingSource Class
description Source code which demonstrates how to create a 'Find' Form with Visual Basic 2005 and the .NET 2.0 Windows Forms BindingSource Class
get resource -> Create 'Find' Form With Visual Basic 2005 and .NET Win Forms BindingSource Class
environment Visual Studio 2005
language Visual Basic
namespace System.Windows.Forms.BindingSource
tags find, bindingsource, visual basic, visual studio

The BindingSource class, new in .NET 2.0, includes a Find method which can be used to get the index of an item in a list with a specified property name and value.

Screen Shot

Sample Code

 

Private Sub FindByLastNameButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FindByLastNameButton.Click

    ' Get the index number of the row in the BindingSource where the value of the

    '   LastName column = the value entered into the FindByLastName TextBox on this form.

    Dim indexNumber As Integer = Me.EmployeesBindingSource.Find("LastName", Me.FindByLastNameTextBox.Text)

    ' Position the binding source on the row.

    Me.EmployeesBindingSource.Position = indexNumber

End Sub

mike mcintyre http://www.getdotnetcode.com

 

 

 

 

 

 

 

 

 



Copyright © 2001-2007 aZ Software Developers. All rights reserved.

 

.