Wrox Programmer Forums
|
Visual Studio 2008 For discussing Visual Studio 2008. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2008 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 17th, 2008, 07:19 PM
Authorized User
 
Join Date: Nov 2007
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chris1012
Default Filter not working grrrrr

hey guys am working on a program at the minute and its not running properly lol basically i've got an update record function but my filter button isn't working properly and i can't figure out why grrr" if any one could help me with this it would be greatly appreciated.

the code that am looking to get working is higlighed below in red the specific part of the code am getting an error with is this

[CustomersBindingSource.Filter = _
"CompanyName LIKE ’%" & filter.Trim & "%’ "]

__________________________________________________ _______________________
PublicClass Form1
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
'TODO: This line of code loads data into the 'NorthwindDataSet.Customers' table. You can move, or remove it, as needed.
Me.CustomersTableAdapter.Fill(Me.NorthwindDataSet.Customers)
EndSub
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
EndSub
PrivateSub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
EndSub
PrivateSub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
'recognise record change with if statement'
If NorthwindDataSet.HasChanges Then
Dim DT As NorthwindDataSet.CustomersDataTable
DT = NorthwindDataSet.Customers.GetChanges()
If DT IsNotNothingThen
Try
CustomersTableAdapter.Update(DT)
'catches errors in update'
Catch ex As Exception
MsgBox(ex.Message)
ExitSub
EndTry
'message box displays total number of updates'
MsgBox(DT.Rows.Count.ToString & _
" rows updated successfully.")
EndIf
EndIf
EndSub


PrivateSub DataGridView1_CellContentClick_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
EndSub
PrivateSub Filter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttnFilter.Click
Dim filter AsString
filter = InputBox("Enter Company name")
CustomersBindingSource.Filter = _
"CompanyName LIKE ’%" & filter.Trim & "%’ "
EndSub
PrivateSub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim newRow AsNew DataRow = Customers.NewRow
newRow.Item(
"CompanyName") = "new company name"
newRow.Item("CustomerName") = "new customer name"
newRow.Item("ContactName") = "new contact name"
DS.Customers.Rows.Add(newRow)
EndSub
End
Class


Thanks in advance Chris1012
__________________
in opposite world i love programming





Similar Threads
Thread Thread Starter Forum Replies Last Post
window.opener working .... not working alyeng2000 Javascript How-To 5 January 5th, 2007 08:05 AM
Web.Config..Working or Not Working peace95 ASP.NET 1.0 and 1.1 Basics 1 September 18th, 2006 06:53 AM
Filter Help mcloum Classic ASP Databases 2 November 10th, 2005 05:40 PM
Filter Help mcloum BOOK: Beginning ASP 3.0 1 August 26th, 2005 03:10 PM
Local COM working , but not working at Web Serv nagen111 .NET Web Services 3 February 19th, 2005 04:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.