Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27061

Remap Data Grid Data Source Programatically

$
0
0
Hey guy's,

I know this might be a newbie question but after 3 days of searching the Internet and experimentation in my test app I just can't figure it out.

I have a single data grid on my winform which needs to change what data is being displayed in it based on a button which is clicked.

EG: I have three buttons on my winform named accounts, contacts, and cases.

What I need to be able to do is when I click on one of those buttons the data source for the datagrid changes as in when I click on the accounts button the datagrid shows all o the accounts in the accounts table in my database.

I have been able to show a single dataset from my database by defining the data source during design from within the component itself but unfortunately I can't figure out how to change it on the fly.

I know how to clear out the datagrid by using the datasource = nothing method but trying to then select an alternate data source has me really stumped

I have connected my database server to my server explorer window in Visual Studio 2010.

Any assistance with this is greatly appreciated.

Viewing all articles
Browse latest Browse all 27061

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>