A
A_PK
I have problem databinding the DataGrid with DataView/DataSet after the
filter...
I create the following proceudre in order for user to filter as many as they
want, but the following code is only allow user to filter the first time,
when they tried the second time, the speficied cast error message will
prompt one....
I create a mydataset1 first, and the mydataset1 data source was getting from
DataGrid.DataSource.
then I create a DataView in order for me to filter....
after I enter the criteria, then will filter successfully the first time,
but not second time.
the I bind the DataGrid to DataView together......
The first filter is always successfully, I just can not filter the same data
second time...
I suspect it the DataView and DataSet problem, because at first I bind
datagrid1 and get the data source of datagrid1 form Dataset, but at the end
I bing the Datagird to the Dataview also.....so there are some error....i
think....
I just have no idea how to bind the Datagrid with Dataview, and allow user
to filter as many time as they want.....
could someone pls guide me.... here are the CODE
Try
Dim mydataset1 As New DataSet
mydataset1 = DataGrid1.DataSource
Dim mydataview As New
DataView(mydataset1.Tables(Global.strTblName))
Dim strInput
strInput = InputBox("test")
mydataview.RowFilter = "Custno = " & strInput & ""
DataGrid1.Datasource= mydataview
' DataGrid1.DataSource = mydataset1
' DataGrid1.DataMember = GlobalDBExplorer.strTblName
Catch err As InvalidCastException
MsgBox(err.Message)
Catch err As Exception
MsgBox(err.Message)
End Try
filter...
I create the following proceudre in order for user to filter as many as they
want, but the following code is only allow user to filter the first time,
when they tried the second time, the speficied cast error message will
prompt one....
I create a mydataset1 first, and the mydataset1 data source was getting from
DataGrid.DataSource.
then I create a DataView in order for me to filter....
after I enter the criteria, then will filter successfully the first time,
but not second time.
the I bind the DataGrid to DataView together......
The first filter is always successfully, I just can not filter the same data
second time...
I suspect it the DataView and DataSet problem, because at first I bind
datagrid1 and get the data source of datagrid1 form Dataset, but at the end
I bing the Datagird to the Dataview also.....so there are some error....i
think....
I just have no idea how to bind the Datagrid with Dataview, and allow user
to filter as many time as they want.....
could someone pls guide me.... here are the CODE
Try
Dim mydataset1 As New DataSet
mydataset1 = DataGrid1.DataSource
Dim mydataview As New
DataView(mydataset1.Tables(Global.strTblName))
Dim strInput
strInput = InputBox("test")
mydataview.RowFilter = "Custno = " & strInput & ""
DataGrid1.Datasource= mydataview
' DataGrid1.DataSource = mydataset1
' DataGrid1.DataMember = GlobalDBExplorer.strTblName
Catch err As InvalidCastException
MsgBox(err.Message)
Catch err As Exception
MsgBox(err.Message)
End Try