|
-
Dec 14th, 2008, 05:27 PM
#1
Thread Starter
Lively Member
datagridview question
Here is my problem. I have a datagridview that display a list of customers (name, address, zip, phone, etc.) using a FillByLastName(@CustomerLastName). When no customer are found it displays an empty datagridview. I can close it but I would rather it not even be displayed if nothing matches. How do I go about doing this?
-
Dec 14th, 2008, 05:40 PM
#2
Re: datagridview question
Test the return value of FillByLastName. If it's zero then there are no matches, so you can either not bind the DataTable to the grid, unbind it if its already (DataSource = Nothing) and Clear the Columns of the grid if necessary.
-
Dec 14th, 2008, 05:47 PM
#3
Thread Starter
Lively Member
Re: datagridview question
i've tested the return value of fillByLastName but my problem is i'm not writing my own data access code. i'm using datasources. is there a way to unbind it if necessary and have it bound otherwise? i hope that makes since.
another question? i'm rather new to vb programming, etc. do most programmers write their own code when it comes to accessing data or do they use datasources?
-
Dec 14th, 2008, 06:05 PM
#4
Re: datagridview question
If you don't necessarily want the DataTable bound then you shouldn't be binding it in the designer. Clear the DataSource property of your DataGridView in the designer so there's no automatic binding. You can then set the DataSource of the grid in code, if and only if there's data to display.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|