11 1874
You can't assign a list object to a dataview object.
so in this case how can I do this kind of research in my Datagrid?
Could you explain how to obtain the same result in this example here? -
Private Sub txtsearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtsearch.TextChanged
-
-
Try
-
-
Dim txtstring As String = Me.txtsearch.Text
-
-
Dim dv As DataView = Me.DataGridView1.DataSource
-
-
dv.RowFilter = "StudentsName LIKE '%" + txtstring + "%'"
-
-
Me.DataGridView1.DataSource = dv
-
-
Catch ex As Exception
-
Throw ex
-
End Try
-
-
End Sub
-
Okay, thank you. But not exactly fills in the DataGrid I want. I want to make queries according what I type in the textbox.
Just like that I'm returning a List Of, I can not do this kind of query.
I want to take this research using BLL I created ... understand?
If I do it this way there is going to work. But would the design pattern that I am organizing.
I have no idea what you said in post #7.
That's just to bind a dataview to the dataviewgrid. You will still need to do your filtering after it.
Sorry, my English is weak, because I'm from Brazil.
About the project, how do I list the data using my BLL class that returns a List of Students?
Using this model below .. -
Public Sub AllStudents()
-
-
_dset = Nothing
-
Try
-
_obj = New DALStudents()
-
_dset = _obj.AllStudents()
-
-
Dim objs As BLLStudents = Nothing
-
_liststudents = New List(Of BLLStudents)
-
-
For index As Integer = 0 To _dset.Tables(0).Rows.Count - 1
-
objs = New BLLStudents
-
objs.StudentsID = _dset.Tables(0).Rows(index)(0).ToString()
-
objs.CursoID = _dset.Tables(0).Rows(index)(1).ToString()
-
objs.EstudanteNome = _dset.Tables(0).Rows(index)(2).ToString()
-
objs.EstudanteEndereco = _dset.Tables(0).Rows(index)(3).ToString()
-
objs.Telefone = _dset.Tables(0).Rows(index)(4).ToString()
-
_liststudents.Add(objs)
-
objs = Nothing
-
Next
-
-
Catch ex As Exception
-
Throw ex
-
Finally
-
_obj = Nothing
-
End Try
-
-
End Sub
-
Well, from your first post, it sounds like you're already listing the data. And it sounded like you were having problems filtering the data, not listing it. If you're actually having problems listing it, that's a completely different problem.
Exactly, in the first post, I can solve the problem. Now this would filter the data in the DataGrid using this model Crud as quoted above. But always give this error:
* Unable to cast object of type 'System.Collections.Generic.List `1 [BLL.BLL.Students.BLLStudents]' to type 'System.Data.DataView'.
You're confusing me. You just said you were having problems listing the data but now you say you're not having problems listing the data. So now we're back to the problem originally stated in the first post.
And the solution to that is in post #5 in the link to Microsoft's documentation on binding a dataview to a dataviewgrid. You have to correctly assign it before you can filter on it.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ruca |
last post by:
Hi gurus,
How can I filter data in my DataSet and then put the result in a DataGrid?
NOTE: I'm reading a txt file into a dataset with 3 columns:
Id, Name, Age
I have this:
...
|
by: RockNRoll |
last post by:
I'm new to ASP.NET and need to filter a datagrid based on a textbox value.
I have a working datagrid and would like the WHERE part of my SQL statement
to call the value of a textbox and refresh...
|
by: Juanjo |
last post by:
I have a datagrid with two temnplate columns. When a row is in edit mode the
each template columns show a dropdownlist (its datasource is a dataview).
I need to filter data of second dropdownlist...
|
by: sg |
last post by:
Hi
I'm starting programming in visual studio and c# and i have a problem
with filtering datagrid. I build form with datagrid and i see data from
database. I find in microsoft web page...
|
by: Richard Fagen |
last post by:
Hi,
What are the best practices to filter a datagrid based on user input?
For example:
I want to display a grid with rows of sales information and allowed the
users to specify options (ex:...
|
by: thebison |
last post by:
Hi all,
I hope someone can help with this relatively simple problem.
I am building a timesheet application using ASP.NET C# with Visual
Studio 2003.As it is only a protoype application, my...
|
by: datttanand |
last post by:
how to filter data in dataset?
suppose i want filter the data in dataset with perticuler city..
|
by: Mapi |
last post by:
I need help.
I am new to MS Access and have been assign this project.
I want to be able to filter data from a form that will be displayed on a subform.
I don't know if this is possible but...
|
by: ahd2008 |
last post by:
Hi everyone,
I have a form for departments and personnel. There are there fields for the sake of search:
DepartmentSearch as combo box
Division\UnitSearch as combo box
Number as combo box
...
|
by: karan desai |
last post by:
I wanted to filter the data, make changes and the save back to the database.
The SQL data adapter and SQL dataset are clashing with TableDataAdapter i.e., db1TableAdpater and DatabseDataSet i.e...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |