Hello, what I want to ask is, (with c#) how is it possible to write the command for such a problem:

I have this form, and on doubleclick it opens a query and i have written the codes for preventing it to pop a window again if its already open (so in short, it only opens a query for once no matter how many times you double click on it) But, the problem is, when i close the opened query, how do i make it pop again on doubleclick? because it does not open anything as soon as i close the popped window

Recommended Answers

All 4 Replies

Welcome to the forum Xinnie, Please introduce yourself at http://www.daniweb.com/forums/forum165.html.

Please read the rules, don't resurrect old threads.

how do i make it pop again on doubleclick? because it does not open anything as soon as i close the popped window

Please clarify what you mean, show some code.

Alright - sorry about not reading the rules.

I've two forms, one for the user list, here are the codes so far :
ListViewItem SecilenKisi;

private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            SecilenKisi = e.Item;

        }
        ArrayList nameList = new ArrayList();
        
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            
            bool bulundu = false;
            
                if(!bulundu)
                {
                    foreach (String names in nameList)
                    {
                        if (nameList.Contains(SecilenKisi.Text))
                        {
                            bulundu = true;
                            break;
                        }
                    }
                    if (bulundu == false)
                    {
                        Form2 frm = new Form2();
                        frm.Show();
                        frm.textBox1.Text = SecilenKisi.Text;
                        nameList.Add(SecilenKisi.Text);
                    }
                }

and I have form2 for the query I'll get as I'll double-click on the choosen nickname.

The problem is when I close the query that I'll get as I'll click on the nickname, I can't reopen the query window.
I guess I need to write some codes in : private void Form2_FormClosing(object sender, FormClosingEventArgs e) .. I just don't know how to, thank you.

PS: SecilenKisi indicates the person choosed and bulundu means found.

Ok its very confusing to read the code without code tagging.

From what I understand when the User click on the username on Form2 you want that username to be passed back to Form1?

string User ="";
Form2 frm = new Form2();
if (frm.ShowDialog() == DialogResult.OK)
{
    frm.textBox1.Text = SecilenKisi.Text;
    nameList.Add(SecilenKisi.Text);
    User = frm.getUser();
}

and in Form2

string Username; // in public space so when a person click on username it gets saved in this variable.
string getUser()
{
   return Username;
}

I don't have a compiler atm so You have be carefull of complier errors. there shouldn't be any but still I am only Human.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.