private void BrowseForServers_Load(object sender, EventArgs e)
 {
     Application.UseWaitCursor = true;
     Application.DoEvents();
     BrowseForServers.SendMessage(Form.ActiveForm.Handle, 0x20, Form.ActiveForm.Handle, (IntPtr)1);
     GetNetworkServerInstances();
     Application.UseWaitCursor = false;
 }
        /// <summary>
        /// Return all network servers
        /// </summary>
        /// <returns></returns>
        public static string BrowseNetworkServers()
        {
            BrowseForServers dialog = new BrowseForServers();

            if (DialogResult.OK == dialog.ShowDialog())
            {
                // return dialog.listBox.Text;
                return(null);
            }

            return(null);
        }
        /// <summary>
        /// Handles the Change event of the Server Name's selection
        /// </summary>
        /// <param name="sender">Object that fired the event</param>
        /// <param name="e">.NET supplied event parameters</param>
        private void cmbServerName_SelectedIndexChanged(object sender, EventArgs e)
        {
            // if last item in list (Browse for Servers)
            if (cmbServerName.SelectedIndex == (cmbServerName.Items.Count - 1))
            {
                string serverName = BrowseForServers.BrowseNetworkServers();
                if (!string.IsNullOrEmpty(serverName))
                {
                    this.cmbServerName.Items.Insert(0, serverName);
                    this.cmbServerName.SelectedIndex = 0;
                    return;
                }

                this.cmbServerName.SelectedText = string.Empty;
            }
        }