private void btnFavorite_Click(object sender, EventArgs e) { clsRecipe rec = new clsRecipe(); clsSQL data = new clsSQL(); // str = DataGridView1.Rows[DataGridView.SelectedRows[0].Index].Cells[X].Value.ToString(); rec.id = Int32.Parse(dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[1].Value.ToString()); rec.name = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[2].Value.ToString(); rec.season = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[3].Value.ToString(); rec.directions = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[4].Value.ToString(); Char[] chararr = dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[5].Value.ToString().ToCharArray(); rec.favorite = chararr[0]; data.favoriteRecipe(rec); MessageBox.Show(rec.name + " has been added to your favorites!"); dgvResults.Rows[dgvResults.SelectedRows[0].Index].Cells[5].Value = "Y"; }
private void btnFavorite_Click(object sender, EventArgs e) { _data.favoriteRecipe(_thisRecipe); MessageBox.Show(_thisRecipe.name + " has been added to your favorites!"); }