private void savedata() { //if (mmdata == null) //{ // mmdata = new mymovies(); // //string di = MovieList[3, e.RowIndex].Value.ToString(); //} mmdata.LocalTitle = LocalTitle.Text; mmdata.OriginalTitle = OriginalTitle.Text; mmdata.SortTitle = SortTitle.Text; mmdata.ProductionYear = ProductionYear.Text; mmdata.RunningTime = Runtime.Text; mmdata.MPAARating = MPAARating.Text; mmdata.IMDBrating = IMDBRating.Text; mmdata.AspectRatio = AspectRatio.Text; mmdata.Type = MovieType.Text; mmdata.Added = DateAdded.Value.ToString("yyy-MM-dd h:mm:ss tt"); mmdata.IMDB = IMDB.Text; mmdata.TMDbId = TMDBID.Text; mmdata.Description = Description.Text; mmdata.Genres.Genre.Clear(); foreach (DataGridViewRow dgr in Genres.Rows) { if (((string)dgr.Cells[0].Value) != null) { mmdata.Genres.Genre.Add((string)dgr.Cells[0].Value); } } mmdata.Studios.Studio.Clear(); foreach (DataGridViewRow dgr in Studios.Rows) { if (((string)dgr.Cells[0].Value) != null) { mmdata.Studios.Studio.Add((string)dgr.Cells[0].Value); } } mmdata.Persons.Clear(); foreach (DataGridViewRow dgr in Directors.Rows) { if (((string)dgr.Cells[0].Value) != null) { mymovies.Person p = new mymovies.Person(); p.Name = (string)dgr.Cells[0].Value; p.Type = "Director"; mmdata.Persons.Add(p); } } foreach (DataGridViewRow dgr in Actors.Rows) { if (((string)dgr.Cells[1].Value) != null) { mymovies.Person p = new mymovies.Person(); p.Name = (string)dgr.Cells[1].Value; p.Type = "Actor"; p.Role = (string)dgr.Cells[3].Value; mmdata.Persons.Add(p); } } mmdata.save(); currentrow.Cells[3].Value = mmdata.XMLComplete ? 1 : 0; }