Hi Daniweb people

I have a really stupid question, strangely it has been keeping me busy for several days now and i just cant help but to ask for help...

ive searched the whole of the MSDN libraries but no code seems to work for this

I am making an application that displays a list of movies

I am using a prebuilt SQL Server 2005 database Connected to a DatagridView

Columns =
1 - ID
2 - Movie_Title
3 - Main_Actor
4 - Release_Year
5 - Genre
6 - Rating

now i can add new rows, no problem, but for some reason (Being a delphi programmer rather than C#) i can not locate the Cursor status to update and Delete selected rows

Any help would be appreciated...

Or maybe tell me what i am missing??

#region GetRow()
        public PaulsDataBaseDataSet3.tblMoviesRow GetRow()
        {
            DataRowView drv;

            try
            {
                drv = (DataRowView)tblMoviesBindingSource.Current;
                return (PaulsDataBaseDataSet3.tblMoviesRow)drv.Row;
            }
            catch (Exception EX)
            {
       MessageBox.Show(EX.Message);
            }
        }
        #endregion

 #region Update Display
        private void UpdateDisplay()
        {
            EditFormMovies EditMovies = new EditFormMovies();
            if (tblMoviesBindingSource.Position == -1)
                return;
            if (UseThisDataSet.tblMovies.Rows[tblMoviesBindingSource.Position].RowState == DataRowState.Deleted)
                return;

            //display original values
            DataRow dr;
            dr = UseThisDataSet.tblMovies.Rows[tblMoviesBindingSource.Position];

            EditMovies.txtID.Text = dr["ID"].ToString();
            EditMovies.txtMovieTitle.Text = dr["Movie_Title"].ToString();
            EditMovies.txtActor.Text = dr["Actors"].ToString();
            EditMovies.txtGenre.Text = dr["Genre"].ToString();
            EditMovies.txtRating.Text = dr["Rating"].ToString();
            EditMovies.txtYear.Text = dr["Release_Year"].ToString();

            if (dr.HasVersion(DataRowVersion.Original))
            {
                EditMovies.txtID.Text = dr["ID", DataRowVersion.Original].ToString();
                EditMovies.txtMovieTitle.Text = dr["Movie_Title", DataRowVersion.Original].ToString();
                EditMovies.txtActor.Text = dr["Actors", DataRowVersion.Original].ToString();
                EditMovies.txtGenre.Text = dr["Genre", DataRowVersion.Original].ToString();
                EditMovies.txtRating.Text = dr["Rating", DataRowVersion.Original].ToString();
                EditMovies.txtYear.Text = dr["Release_Year", DataRowVersion.Original].ToString();
            }
            else
            {
                EditMovies.txtID.Text = "";
                EditMovies.txtMovieTitle.Text = "";
                EditMovies.txtActor.Text = "";
                EditMovies.txtGenre.Text = "";
                EditMovies.txtRating.Text = "";
                EditMovies.txtYear.Text = "";

            }

#region Delete Button
        private void btnDelete_Click(object sender, EventArgs e)
        {
           DataRow dr;
           dr = GetRow(); 
           dr.Delete(); 
           UpdateDisplay();
        }
#endregion

If you connected the data source correctly it should be automatically updated

I think the OP left 4 years ago, and probably went to Mars or is there already.

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.