Hey there. Troubled once again, and this one i cant find on the internet.
I have a datagridview. I can update it perfectly, when i type in data into the datagridwiew and press the button. So that works.
Now i have a form that pops up with 2 txtboxes and a date Lable. that when the button is clicked it will store those 3 values into the datagridview, update it, and exit. eccept... it doesnt want to work...
Its like if i add data to the datagridview i assume the datagridview is selected when i press the update button. But when the values are added programatically, it appears on my datagridwiew, but it doesnt want to update it as, (i think) the datagridview isnt selected or something??
Do i have to add code that selects the datagridview before it updates?
This is my code.
private void button1_Click(object sender, EventArgs e)
{
// insert Values into Datagridview
tblAllEntries.Rows[0].Cells[1].Value = lbldate.Text.ToString();
tblAllEntries.Rows[0].Cells[2].Value = txtboxReminder.Text.ToString();
tblAllEntries.Rows[0].Cells[3].Value = txtboxCost.Text.ToString();
tblAllEntries.Rows[0].Cells[0].Selected = true; ---<<< I added this because i thought it had to be selected, but it didnt work..
dAdapter.Update(dTable);
}
that is button tho insert it and update. But it only adds it to the datagridview and doesnt want to update.
If i add a button with just ' dAdapter.Update(dTable);' It updates what i Manually Tiped into the datagridview, and works.
What can i do to save it INSTEAd of putting in a method to run that button after the save button has been clicked?
Thank you =)=)