Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VS 2005 complex filer for the bindingsource property

Status
Not open for further replies.

steve1rm

Programmer
Aug 26, 2006
255
GB
Hello,

I am binding a bindingsource to a datagridview and I have set the bindingsource to filter based on conditions.

However, I think that the criteria i have is too complex to put in the filter.

Is there an easier method to use.

I will try my best to explain the criteria:
AssemblyID, category, Type

Type (components, equipment, software)

Category - software (Office, DB, Anti-virus)
Category - components(memory, processor, input)
Category - equipment(printers, display, keyboard)

For example the customer could select from some combo boxes the category that want to display for that type.

I have tried doing something with the string.format e.g.
Code:
dim criteria as string = string.empty
criteria = string.format(AssemblyID = {0} AND Category = {1} AND Type = {2}",assemblyID, cboSoftware.text, cboType.text)

bindingsource.filter = criteria
dgvParts.datasource = bindingSource
The above didn't work, so sure that filter can handle it.

Another problem I have is that i need to display many combinations for instance the user could select either software, components, or software. and the individual category for each one.

For example the user could select to find software and the category CPU, and also display components with category memory.

I think to solve this problem I would have to write many if statements, which I want to avoid doing. Is there a better more cleaner method to do this.

Many thanks for any suggestions.

Steve
 
the data should be similar across all categories, so that if you are trying to use the same form for all that the end user is not "thrown" when they switch categories. do you have all the data in the same table? or do you have multiple tables in your datasource?

-The answer to your problem may not be the answer to your question.
 
Hello,

Thanks for your reply,

Yes the data is all in the same table.

Thanks,

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top