7
Answers

label text need't to update

Hi all
i made a doubleclick event in a dataGridView, all i need to when i double click on row save the data in the row to a global List declered in a class file, and then change some labels text in another form depend on this List.
But what happens with me all thing is right after i make the 1st double click and close the 2nd form (that contans the labels) after i open the 2nd form again and do double click in the 1st form nothing happens, but when i do many clicks it works.
 
the code of the celldoubleclick:
  1. private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)  
  2.        {  
  3.            GlobalVariables.CustomerInfoList.Add(dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[0].Value.ToString());  
  4.            GlobalVariables.CustomerInfoList.Add(dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[1].Value.ToString());  
  5.            GlobalVariables.CustomerInfoList.Add(dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[2].Value.ToString());  
  6.            GlobalVariables.CustomerInfoList.Add(dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[3].Value.ToString());  
  7.            GlobalVariables.CustomerInfoList.Add(dataGridView1.Rows[dataGridView1.SelectedRows[0].Index].Cells[7].Value.ToString());  
  8.        }  

 the code of global variables

 
  1. class GlobalVariables  
  2.    {  
  3.   
  4.        public static string connectionString;  
  5.        public static string user = "User";  
  6.        public static string placeName = "";  
  7.        public static string permissions = "";  
  8.        public static List<string> CustomerInfoList = new List<string>();  
  9.    }  
the code of 2nd form happens in timer
 
  1. private void timer1_Tick(object sender, EventArgs e)  
  2.        {  
  3.            if (GlobalVariables.CustomerInfoList.Count != 0)  
  4.            {  
  5.                customerIdNumberLabel.Text = GlobalVariables.CustomerInfoList[0];  
  6.                customerNameTB.Text = GlobalVariables.CustomerInfoList[1] + " " + GlobalVariables.CustomerInfoList[2] + " " + GlobalVariables.CustomerInfoList[3];  
  7.                mobileTB.Text = GlobalVariables.CustomerInfoList[4];  
  8.                customerIdNumberLabel.Visible = true;  
  9.                GlobalVariables.CustomerInfoList.Clear();  
  10.            }  
  11.        }  
 
 
 
Answers (7)
0
Bechir Bejaoui
NA 20.1k 5.3m 16y

In this case you have to implement security logic, the .Net provides an entire API  System.Security, you can create a permission set that determines rule of messages transactions 
0
Riccardo
NA 5 0 16y
I mean every outgoing mail of a company (mail from a internal network to outside the network)
0
Bechir Bejaoui
NA 20.1k 5.3m 16y

What do you mean by outgoing mail, do you mean from example a spam?
0
Riccardo
NA 5 0 16y
Thank you very much for your answer!

Probably I should explain a little bit more about the functionality I would like to implement. Basicaly I would like to check every outgoing mail. Therefore I would like to
1. stop the smtp queue
2. wait for messages
3.check these messages (allowed or unallowed and probably remove some of them)
4. Start the smtp queue, so the messages can be send


0
Bechir Bejaoui
NA 20.1k 5.3m 16y

If I well understand your question you're using a Message queue object then you can do

MessageQueue mqueue = new MessageQueue();
            //This method will make the message queue in a standby state for any message
            IAsyncResult Async = mqueue.BeginReceive();

            //TO do perform you code here

            //This method
            Message Recived = mqueue.EndReceive(Async);
           
            //close the message queue
            mqueue.Close();
It's better to do that asynchormously