Home All Groups Group Topic Archive Search About

DataNavigator AddNew problem

Author
26 Apr 2006 9:26 AM
marknotgeorge
I have a form in my c# application for adding the details for a car
(it's a car restoration database).
This form has a DataNavigator, and it also has a GroupBox which has
controls to allow the user to add images to the database. This groupbox
also has a datanavigator. It all seems to work fine, except for as
minor problem adding images. I use the following code to add a new
image to the bound PictureBox:
private void bindingNavigatorAddNewItem1_Click(object sender, EventArgs
e)
        {
            base.OnClick(e);
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                string filename = openFileDialog.FileName;
                if (filename.Length != 0)
                {
                    try
                    {
                        imagePictureBox.Image = new Bitmap(filename);
                        imagePictureBox.Show();
                    }
                    catch
                    {
                        MessageBox.Show(String.Format("{0} is not a
valid image file!", filename),
                                                       "Error",

MessageBoxButtons.OK,

MessageBoxIcon.Error);
                    }
                }
            }

This seems to work ok, but the image isn't added to the database until
the addnew button is pressed again. I seem to be missing something.

Thanks for any help.

Mark Johnson
Derby, UK
        }

AddThis Social Bookmark Button