I'm currently working on an application that shows whether colleagues are present at work. To make it a bit 'easy' to use for the one who's going to manage it, I want the user to be able to double click a listview item of a user, that prompts a window where the status of that person can be changed.
It was fairly easy to prompt a messagebox with the abbreviation of the selected person (which acts as a primary key for the database used). However, I want this abbreviation to be passed over to the textbox in that other window.
This is what I use to launch the window to change the employee status:
frmStatusEdit SE = new frmStatusEdit();
SE.Show();
Keep in mind tho: this code works fine; the window launches without any issue. However, upon doube clicking a user, the window launches without the textbox containing its abbreviation.
For some reason I can't get this to work, despite using this line, which worked succesfully with the messagebox:
MessageBox.Show(lvEmployees1.SelectedItems[0].Text);
When I use this (with SE referring to the other window), nothing happens:
if (lvEmployees1.SelectedItems.Count > 0)
{
string listItem = lvEmployees1.SelectedItems[0].Text;
SE.tbxAbbrevEmployee.Text = listItem;
}
I've been searching for a solution and came across several, but none seem to fix the issue. No error message is shown either, making it even more difficult to find out what I do wrong.
Anyone who has an idea what I might be doing wrong? I'm not very experienced with coding, so it's easy to forget things in my case.