Am developing a software for submission as project. As a part of it, am planning to create a Phonebook package. I created a database in access and i integrated it in VB.Net.
Information:
Database name : Contacts.accdb
DataTable : Contacts
Contents in table : First Name,Last Name, Phone, Address...
Platform : VB.NET in Visual Studio 2010
I integrated the access database in VB.NET using Data->Add new Data source and I successfully made it. Now I got a DataGridView. :) Now arises a question How to search a name in "First Name" Column? I just Googled to find row Filter. That appeared gr8 to me till I got a problem of adding new records. Once I applied Filter, I couldn't see the Addition of new records and I can't make selection process in DataGridView. Then I found that Filtering is not Searching. Any one to help me in searching the data in Dataview? I'll post my codes here:
Public Class Form1
Private Sub ContactsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContactsBindingNavigatorSaveItem.Click
Me.Validate()
Me.ContactsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.ContactsDataSet)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'ContactsDataSet.Contacts' table. You can move, or remove it, as needed.
Me.ContactsTableAdapter.Fill(Me.ContactsDataSet.Contacts)
End Sub
Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
Dim dv As DataView = New DataView()
dv.Table = ContactsDataSet.Contacts
dv.RowFilter = "[First Name] Like '" & TextBox1.Text & "%'"
ContactsDataGridView.DataSource = dv
End Sub
End Class
I have a textbox named "TextBox1", Binding navigator that is automatically generated on copying the DataGrid named "ContactsBindingNavigator" and DataGrid cotaining Contacts table named "ContactsDataGridView". Any one help me.. Thanks!