Home All Groups Group Topic Archive Search About

Datagridview...cepopulating

Author
20 Dec 2006 2:03 PM
Arne Beruldsen
I have a datagridview which loads fine on startup.  However...the user has
the opportunity to refine the data.  For some reason...the refined search is
added to the end.  I've tried clearing the rows first --

Me.DataGridView1.Rows.Clear()

but the previous search returns and the new data added.  Here are a few
lines of the code...

Me.DataGridView1.DataSource = Nothing
        Me.DataGridView1.Rows.Clear()
        Me.DataGridView1.Refresh()
        Me.DataGridView1.DataSource = SxSource

        GetData("Select LastName, FirstName, TestName,TestDate, Score, ID
from TestScores where TestName ='" & ListBoxControl3.Text & "' ")

VS 2005

What am I missing?

Thanks

Author
20 Dec 2006 2:16 PM
Terry Olsen
You are clearing out the DataGridView, but you should be clearing out the
SxSource instead. Re-run your query to fill it, then perform a
DataGridView1.Update

Show quoteHide quote
"Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> wrote in message
news:06CAA76B-5D3F-4A63-B53A-E56565859DCB@microsoft.com...
>I have a datagridview which loads fine on startup.  However...the user has
> the opportunity to refine the data.  For some reason...the refined search
> is
> added to the end.  I've tried clearing the rows first --
>
> Me.DataGridView1.Rows.Clear()
>
> but the previous search returns and the new data added.  Here are a few
> lines of the code...
>
> Me.DataGridView1.DataSource = Nothing
>        Me.DataGridView1.Rows.Clear()
>        Me.DataGridView1.Refresh()
>        Me.DataGridView1.DataSource = SxSource
>
>        GetData("Select LastName, FirstName, TestName,TestDate, Score, ID
> from TestScores where TestName ='" & ListBoxControl3.Text & "' ")
>
> VS 2005
>
> What am I missing?
>
> Thanks
>
Author
20 Dec 2006 3:11 PM
Arne Beruldsen
I added the datagridview1,update...after the GetData line...and it still
simply adds to the end...

I'm confused...

Show quoteHide quote
"Terry Olsen" wrote:

> You are clearing out the DataGridView, but you should be clearing out the
> SxSource instead. Re-run your query to fill it, then perform a
> DataGridView1.Update
>
> "Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> wrote in message
> news:06CAA76B-5D3F-4A63-B53A-E56565859DCB@microsoft.com...
> >I have a datagridview which loads fine on startup.  However...the user has
> > the opportunity to refine the data.  For some reason...the refined search
> > is
> > added to the end.  I've tried clearing the rows first --
> >
> > Me.DataGridView1.Rows.Clear()
> >
> > but the previous search returns and the new data added.  Here are a few
> > lines of the code...
> >
> > Me.DataGridView1.DataSource = Nothing
> >        Me.DataGridView1.Rows.Clear()
> >        Me.DataGridView1.Refresh()
> >        Me.DataGridView1.DataSource = SxSource
> >
> >        GetData("Select LastName, FirstName, TestName,TestDate, Score, ID
> > from TestScores where TestName ='" & ListBoxControl3.Text & "' ")
> >
> > VS 2005
> >
> > What am I missing?
> >
> > Thanks
> >
>
>
>
Author
21 Dec 2006 5:31 AM
Cor Ligthert [MVP]
Arne,

Please do not multipost in 2 hours, now I gave you exact the same answer as
Terry.

Cor

Show quoteHide quote
"Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> schreef in
bericht news:ABA660C0-BADD-4E2D-986F-557885271DD4@microsoft.com...
>I added the datagridview1,update...after the GetData line...and it still
> simply adds to the end...
>
> I'm confused...
>
> "Terry Olsen" wrote:
>
>> You are clearing out the DataGridView, but you should be clearing out the
>> SxSource instead. Re-run your query to fill it, then perform a
>> DataGridView1.Update
>>
>> "Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> wrote in
>> message
>> news:06CAA76B-5D3F-4A63-B53A-E56565859DCB@microsoft.com...
>> >I have a datagridview which loads fine on startup.  However...the user
>> >has
>> > the opportunity to refine the data.  For some reason...the refined
>> > search
>> > is
>> > added to the end.  I've tried clearing the rows first --
>> >
>> > Me.DataGridView1.Rows.Clear()
>> >
>> > but the previous search returns and the new data added.  Here are a few
>> > lines of the code...
>> >
>> > Me.DataGridView1.DataSource = Nothing
>> >        Me.DataGridView1.Rows.Clear()
>> >        Me.DataGridView1.Refresh()
>> >        Me.DataGridView1.DataSource = SxSource
>> >
>> >        GetData("Select LastName, FirstName, TestName,TestDate, Score,
>> > ID
>> > from TestScores where TestName ='" & ListBoxControl3.Text & "' ")
>> >
>> > VS 2005
>> >
>> > What am I missing?
>> >
>> > Thanks
>> >
>>
>>
>>