Click here to Skip to main content
15,917,795 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating a completely unclickable WebBrowser Pin
SimpleData24-Jul-09 4:11
SimpleData24-Jul-09 4:11 
GeneralRe: Creating a completely unclickable WebBrowser Pin
Eddy Vluggen24-Jul-09 4:20
professionalEddy Vluggen24-Jul-09 4:20 
GeneralRe: Creating a completely unclickable WebBrowser Pin
SimpleData24-Jul-09 4:29
SimpleData24-Jul-09 4:29 
GeneralRe: Creating a completely unclickable WebBrowser Pin
musefan24-Jul-09 4:47
musefan24-Jul-09 4:47 
GeneralRe: Creating a completely unclickable WebBrowser Pin
Eddy Vluggen24-Jul-09 5:57
professionalEddy Vluggen24-Jul-09 5:57 
AnswerRe: Creating a completely unclickable WebBrowser Pin
BillWoodruff24-Jul-09 5:14
professionalBillWoodruff24-Jul-09 5:14 
QuestionMCI Video Playback - How to get MPEG-4 to work Pin
shultas24-Jul-09 3:22
shultas24-Jul-09 3:22 
Questiontimer control in C# Pin
wasifmuneer24-Jul-09 2:59
wasifmuneer24-Jul-09 2:59 
AnswerRe: timer control in C# Pin
Manas Bhardwaj24-Jul-09 3:03
professionalManas Bhardwaj24-Jul-09 3:03 
GeneralRe: timer control in C# Pin
wasifmuneer24-Jul-09 3:05
wasifmuneer24-Jul-09 3:05 
GeneralRe: timer control in C# Pin
Manas Bhardwaj24-Jul-09 3:09
professionalManas Bhardwaj24-Jul-09 3:09 
GeneralRe: timer control in C# Pin
wasifmuneer24-Jul-09 3:10
wasifmuneer24-Jul-09 3:10 
QuestionCopy text to clipboard Pin
jaro1624-Jul-09 2:00
jaro1624-Jul-09 2:00 
AnswerRe: Copy text to clipboard Pin
Abhijit Jana24-Jul-09 2:05
professionalAbhijit Jana24-Jul-09 2:05 
AnswerRe: Copy text to clipboard [modified] Pin
musefan24-Jul-09 2:11
musefan24-Jul-09 2:11 
AnswerRe: Copy text to clipboard Pin
Luc Pattyn24-Jul-09 4:07
sitebuilderLuc Pattyn24-Jul-09 4:07 
GeneralRe: Copy text to clipboard Pin
jaro1624-Jul-09 6:03
jaro1624-Jul-09 6:03 
Questiongetting timeout expired error Pin
venu65624-Jul-09 1:49
venu65624-Jul-09 1:49 
RantRe: getting timeout expired error Pin
musefan24-Jul-09 2:08
musefan24-Jul-09 2:08 
AnswerRe: getting timeout expired error Pin
MumbleB24-Jul-09 2:46
MumbleB24-Jul-09 2:46 
AnswerRe: getting timeout expired error Pin
Dave Kreskowiak24-Jul-09 4:08
mveDave Kreskowiak24-Jul-09 4:08 
Answer1 lac = 100,000 : Re: getting timeout expired error Pin
BillWoodruff24-Jul-09 5:19
professionalBillWoodruff24-Jul-09 5:19 
QuestionInresponsive program during an Active Directory search. Pin
Hardus Lombaard24-Jul-09 1:42
Hardus Lombaard24-Jul-09 1:42 
Below is some code that validates entries in a datagridview against entries in Active Directory and changes the color of the datagridview cells accordingly. A progressbar indicates how far the process is from finish. If the user then interacts with the form either by dragging one of the datagridview scrollbars or pressing a button, the program becomes unresponsive and the form doesn't refresh any longer until after the process is finished, thereby causing the progressbar to loose its functionality. How can I overcome this glitch? I would also like to implement a cancel button so that the user can cancel the validation process at any moment, but if a button is pressed I experience the problem mentioned above. Any help would be appreciated. Thanx.

private void btnCheck_Click(object sender, EventArgs e)
{
                  using (DirectoryEntry de = new DirectoryEntry(adPath, adUsername, adPassword)) //))                 
                  {
                        de.Username = Environment.UserName;
                        de.AuthenticationType = AuthenticationTypes.Secure;
                        //these are the attributes that will show              
                        string[] attribs = new string[] { "displayName", "mail", "userAccountControl" };
                        for (int x = 0; x < dgvManager.Rows.Count - 1; x++)
                        {
                              ValidateDetails(4, 5, 6, x, de, attribs); //Second in charge
                              ValidateDetails(7, 8, 9, x, de, attribs); //Branch Manager
                              ValidateDetails(10, 11, 12, x, de, attribs); //Regional Manager
                              ValidateDetails(13, 14, 15, x, de, attribs); //General Manager
                              ValidateDetails(16, 17, 18, x, de, attribs); //Managing Director

                              progressBar.Value = Convert.ToInt32(Convert.ToDecimal(x) / dgvManager.Rows.Count * 100);
                              lblPercent.Text = Convert.ToInt32((Convert.ToDecimal(x) / dgvManager.Rows.Count * 100)).ToString() + "%";
                              this.Refresh();
                        }//for
                  }//using
}


private void ValidateDetails(int cell1, int cell2, int cell3, int row, DirectoryEntry de, string[] attribs)
            {
                  DirectorySearcher ds = null;
                  string y = "", u = "", z = "", sFilter = "";
                  //use the username as search key
                  if (dgvManager.Rows[row].Cells[cell3].Value.ToString() != "")
                  {
                        sFilter = String.Format(
                              "(&(objectCategory=person)(sAMAccountName={0}))",
                              dgvManager.Rows[row].Cells[cell3].Value.ToString().Split(new char[] { '\\' })[1]
                              );
                        ds = new DirectorySearcher(de, sFilter, attribs);
                        using (SearchResultCollection src = ds.FindAll())
                        {
                              SearchResult sr = null;
                              if (src.Count > 0)
                              {
                                    sr = src[0];
                                    dgvManager.Rows[row].Cells[cell3].Style.BackColor = Color.LightGreen;
                                    dgvManager.Rows[row].Cells[cell2].Style.BackColor = Color.LightGreen;
                                    dgvManager.Rows[row].Cells[cell1].Style.BackColor = Color.LightGreen;
                                    if (sr.Properties["mail"].Count != 0)
                                    {

                                          z = sr.Properties["mail"][0].ToString();
                                          if (z.ToLower() != dgvManager.Rows[row].Cells[cell2].Value.ToString().ToLower()) //email address
                                                dgvManager.Rows[row].Cells[cell2].Value = z;
                                    }
                                    else
                                          dgvManager.Rows[row].Cells[cell2].Value = "";
                                    if (sr.Properties["displayname"].Count != 0)
                                    {
                                          y = sr.Properties["displayName"][0].ToString();
                                          if (y.ToLower() != dgvManager.Rows[row].Cells[cell1].Value.ToString().ToLower()) //display name
                                                dgvManager.Rows[row].Cells[cell1].Value = y;
                                    }
                                    else
                                          dgvManager.Rows[row].Cells[cell1].Value = "";
                                    if (sr.Properties["userAccountControl"].Count != 0)
                                    {
                                          u = sr.Properties["userAccountControl"][0].ToString();
                                          if (u == "514" | u == "66050") // account disabled
                                                dgvManager.Rows[row].Cells[cell3].Style.BackColor = Color.Orange;
                                    }
                                    else
                                          dgvManager.Rows[row].Cells[cell3].Style.BackColor = Color.Orange;
                              }
                              else
                              {
                                    dgvManager.Rows[row].Cells[cell3].Style.BackColor = Color.Red;
                                    dgvManager.Rows[row].Cells[cell2].Style.BackColor = Color.Red;
                                    dgvManager.Rows[row].Cells[cell1].Style.BackColor = Color.Red;
                              }
                        }
                  }
                  else
                  {
                        dgvManager.Rows[row].Cells[cell3].Style.BackColor = Color.Red;
                        dgvManager.Rows[row].Cells[cell2].Style.BackColor = Color.Red;
                        dgvManager.Rows[row].Cells[cell1].Style.BackColor = Color.Red;
                  }
            }
AnswerRe: Inresponsive program during an Active Directory search. Pin
musefan24-Jul-09 2:02
musefan24-Jul-09 2:02 
AnswerRe: Inresponsive program during an Active Directory search. Pin
Abhijit Jana24-Jul-09 2:09
professionalAbhijit Jana24-Jul-09 2:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.