Here is one way....
SqlConnectionStringBuilder cnStr = new SqlConnectionStringBuilder();
cnStr.UserID = this.txtUsername.Text;
cnStr.Password = this.txtPassword.Text;
cnStr.DataSource = this.cboSQLServer.Text;
cnStr.ConnectTimeout = 30;
SqlConnection cn = new SqlConnection();
cn.ConnectionString = cnStr.ConnectionString;
cn.Open();
System.Data.DataTable dbList = cn.GetSchema("Databases");
foreach (System.Data.DataRow row in dbList.Rows)
{
this.cboDatabase.Items.Add(row[0]);
}