|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Datagridview -- Won't Clearsubsequent searches are added to the end. I can't seem to claer the grid with only the new info. My code... Private Sub GetData(ByVal selectCommand As String) Try SxAdapter = New OleDbDataAdapter(selectCommand, CS) Dim MyCommandBuilder As New OleDbCommandBuilder(SxAdapter) SxTable.Locale = System.Globalization.CultureInfo.InvariantCulture Me.SxAdapter.Fill(SxTable) Me.SxSource.DataSource = SxTable Catch ex As OleDbException MessageBox.Show("Error") End Try End Sub Me.DataGridView1.DataSource = Nothing Me.DataGridView1.Rows.Clear() Me.DataGridView1.DataSource = SxSource GetData("Select LastName, FirstName, TestName,TestDate, Score, ID from TestScores where TestName ='" & ListBoxControl3.Text & "' ") Me.DataGridView1.Update() What am I doing wrong? Arne,
Probably is it because youi clear nowhere that SXTable. SXTable.clear. Cor Show quoteHide quote "Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> schreef in bericht news:BEFF1675-E44E-4838-B00F-A52C42DD2853@microsoft.com... >I have a Datagridview which populates fine...but when I refine the >data...the > subsequent searches are added to the end. I can't seem to claer the grid > with only the new info. > > My code... > > Private Sub GetData(ByVal selectCommand As String) > Try > SxAdapter = New OleDbDataAdapter(selectCommand, CS) > Dim MyCommandBuilder As New OleDbCommandBuilder(SxAdapter) > SxTable.Locale = > System.Globalization.CultureInfo.InvariantCulture > Me.SxAdapter.Fill(SxTable) > Me.SxSource.DataSource = SxTable > Catch ex As OleDbException > MessageBox.Show("Error") > End Try > End Sub > > Me.DataGridView1.DataSource = Nothing > Me.DataGridView1.Rows.Clear() > Me.DataGridView1.DataSource = SxSource > GetData("Select LastName, FirstName, TestName,TestDate, Score, ID > from TestScores where TestName ='" & ListBoxControl3.Text & "' ") > Me.DataGridView1.Update() > > What am I doing wrong? Thanks...that did the trick...
Show quoteHide quote "Cor Ligthert [MVP]" wrote: > Arne, > > Probably is it because youi clear nowhere that SXTable. > > SXTable.clear. > > Cor > > "Arne Beruldsen" <ArneBeruld***@discussions.microsoft.com> schreef in > bericht news:BEFF1675-E44E-4838-B00F-A52C42DD2853@microsoft.com... > >I have a Datagridview which populates fine...but when I refine the > >data...the > > subsequent searches are added to the end. I can't seem to claer the grid > > with only the new info. > > > > My code... > > > > Private Sub GetData(ByVal selectCommand As String) > > Try > > SxAdapter = New OleDbDataAdapter(selectCommand, CS) > > Dim MyCommandBuilder As New OleDbCommandBuilder(SxAdapter) > > SxTable.Locale = > > System.Globalization.CultureInfo.InvariantCulture > > Me.SxAdapter.Fill(SxTable) > > Me.SxSource.DataSource = SxTable > > Catch ex As OleDbException > > MessageBox.Show("Error") > > End Try > > End Sub > > > > Me.DataGridView1.DataSource = Nothing > > Me.DataGridView1.Rows.Clear() > > Me.DataGridView1.DataSource = SxSource > > GetData("Select LastName, FirstName, TestName,TestDate, Score, ID > > from TestScores where TestName ='" & ListBoxControl3.Text & "' ") > > Me.DataGridView1.Update() > > > > What am I doing wrong? > > >
VB.Net advice needed
Windows History Deletion Using Web.config's <system.web><pages><controls><add /></controls></pages></system.web> To Register VB and CCTV Run Program only once System.Nullable 2.0 Framework Datagridview...cepopulating typecast array to bindinglist TableAdapters ( 2.0 ) Mailmerge date problem |
|||||||||||||||||||||||