private void personelList_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            string text = personelList.GetItemText(personelList.SelectedItem);

            if (!string.IsNullOrEmpty(text))
            {
                var person = _personels.Where(p => p.Name == text).FirstOrDefault <Personel>();
                //MessageBox.Show(person.Name);



                var form = new  PersonelForm(person);
                form.Show();
                this.Close();
                //int index = this.personelList.IndexFromPoint(e.Location);
                //if (index != System.Windows.Forms.ListBox.NoMatches)
                //{

                //    //MessageBox.Show(index.ToString());

                //    //do your stuff here

                //}
                //var form = new RibbonForm1();
                //form.Show();
            }
        }
Example #2
0
 private void Find()
 {
     try
     {
         var personelid = Int16.Parse(txtPersonel.Text);
         var error      = "";
         var person     = DAL.GetDAta.GetPersonel(personelid, ref error);
         if (person.Id == 0)
         {
             MessageBox.Show("پرونده ای برای نمایش وجود ندارد.");
         }
         else
         {
             var form = new PersonelForm(person);
             form.Show();
         }
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     }
 }