Sorting data using BindingSource C#.Net

03/05/2007 - 11:07 por Peter Matogo | Informe spam
Hello people,

I have a problem that has been nagging me for quite some time now...let
me give you a brief description:

I have on my form 4 controls:
-An ordinary TextBox
-A DataGridView
-A DataSet
-and a BindingSource
the DataSource for the DataGridView is the BindingSource control. The
data source for the BindingSource is the DataSet.
So when the user enters some text in the TextBox the DataGridView is
automatically filtered. I used the following line of code to apply the
filter:
productsBindingSource.Filter = string.Format("Name like '%{0}%'",
txtFilter.Text);

that works fine

now the problem comes in when i try to get the index of the filtered
data in the DataGridView.For example, the first item in the filtered
text picks the first item in the original set.
So how can i update or refresh the data after I apply the filter??
Any help will be greatly appreciated

*** Sent via Developersdex http://www.developersdex.com ***

Preguntas similare

Leer las respuestas

#1 ANT1
03/05/2007 - 11:34 | Informe spam
On 3 mayo, 11:07, Peter Matogo wrote:
Mostrar la cita
If datagridview.refresh() doesn't work try to unbind de source and
rebind it.

datagridview.datasource = null;
datagridview.datasource = yourdatabindingsource;
#2 ANT1
03/05/2007 - 11:42 | Informe spam
Mostrar la cita
Sorry I clicked to send de post before finish de coment.

Before rebind the datasource make the datagridview.Refresh();

I'm not sure if it's that what you are asking to, but hope it'll help
you.
#3 Juan Diego Bueno
03/05/2007 - 11:57 | Informe spam
Mostrar la cita
ANT1, nos tienes que explicar esa nueva forma de españolizar
"the" (suponiendo que fuera lo que quisieras poner). Hubiera quedado
más rapero (en plan don't believe da hype) que hubieras usado "da" xD

Na, es coña... Supongo que este hombre te haya entendido, aunque este
sea un grupo de noticias en castellano.

Saludos
#4 ANT1
03/05/2007 - 11:59 | Informe spam
On 3 mayo, 11:57, Juan Diego Bueno wrote:
Mostrar la cita
Jejeje

Ya he visto, me pasa bastante a menudo, me distraigo y escribo mal el
"the". Ademas veo que lo he puesto mal un par de veces.

Espero realmente que lo entendiese. Jeje
Ads by Google
Search Busqueda sugerida