Your code can run the following script to get all the databases on your server.
select dbid, name from master.dbo.sysdatabases
Just put it in a refresh button click_event.
If you are doing this in a view on the database,
Since this is just like any other table, just join it to whatever you need to.
Good Luck
Brent