A message to let know the recorded information

Post your questions regarding programming in C# in here.
4 posts Page 1 of 1
Contributors
User avatar
hortencio
New Member
New Member
Posts: 19
Joined: Thu Apr 19, 2012 1:41 am

First of all i want say thanks to all of you for your admirable help since a entered in this forum.

My question is: Thire is any way how to konw if a record is repited by showing a message?

i´m using C#
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

You could check for repeats/duplicates in a listbox with this:
Code: Select all
        private void btnCheck_Click(object sender, EventArgs e)
        {

            for (int i = 0; i < listBox1.Items.Count; i++)
            {

                for (int i2 = 0; i2 < listBox1.Items.Count; i2++)
                {

                    if (i != i2 && listBox1.Items[i] == listBox1.Items[i2])
                    {
                        MessageBox.Show("Duplicate items at index " + i + " and " + i2);

                    }
                }
            }
        }
User avatar
hortencio
New Member
New Member
Posts: 19
Joined: Thu Apr 19, 2012 1:41 am

Now how can i conect the listbox to my database? I mean the information that i´ll be adding in the database how can it go to the listbox.
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

It depends on which type of database you are using and how you are currently storing the data.
4 posts Page 1 of 1
Return to “General coding help”