CSharpTutor.Controls.ContactControl.ContactControlLoad C# (CSharp) Method

ContactControlLoad() private method

On Load
private ContactControlLoad ( object sender, EventArgs e ) : void
sender object sender
e System.EventArgs e
return void
        private void ContactControlLoad(object sender, EventArgs e)
        {
            //clean up the response and request areas
            FrmMain.RequestString = string.Empty;
            FrmMain.ResponseString = string.Empty;

            _contacts.Clear();

            try
            {
                //get list members
                string strRequest;
                string strResponse;

                Cursor.Current = Cursors.WaitCursor;

                _contacts = OperationsComponent.GetContacts(CredentialsDetails, FrmMain.CurrentSelectedList.Id,
                                                            out strRequest, out strResponse);

                Cursor.Current = Cursors.Default;

                FrmMain.RequestString = strRequest;
                FrmMain.ResponseString = strResponse;

                //set up grid view data source
                LblList.Text = string.Format("Contact list {0} members:", FrmMain.CurrentSelectedList.Name);
                dgwContacts.DataSource = _contacts;

                //disable the update contact button if there aren't any contacts
                if (_contacts.Count == 0)
                    BtnModify.Enabled = false;

            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, Resources.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            Cursor.Current = Cursors.Default;
        }