2 Replies - 6158 Views - Last Post: 29 May 2009 - 12:38 AM Rate Topic: -----

#1 TomVdV   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 28-May 09

Listview Update Data

Posted 28 May 2009 - 01:55 AM

Hi,

I’ve some problems with my C# program.

I can update the data in the database with textboxes.
But the data doesn’t update directly in the listview.

->I don’t work with databinding, so refresh didn’t work.
-> .Text works only for the first item of the row.

Is there an other option to update the row in the listview or did I need to clear the listview and load the data again?


private void btSnelheidMetBalWijzigen_Click(object sender, EventArgs e)
		{
			if (lstSnelhMetBal.SelectedItems.Count !=1) return;

			var lvi = lstSnelhMetBal.SelectedItems[0];
			var s = lvi.Tag as SnelheidMetBal;

			s.Datum = dtpSnelheidMetBal.Value;
			s.Tijd1 = DateTime.Parse(txtSnelheidMetBalTijd1.Text);
			s.Goal1 = chkGoal1.Checked;
			s.Tijd2 = DateTime.Parse(txtSnelheidMetBalTijd2.Text);
			s.Goal2 = chkGoal1.Checked;
			s.Tijd3 = DateTime.Parse(txtSnelheidMetBalTijd3.Text);
			s.Goal3 = chkGoal3.Checked;
			s.Trainingsschema = txtSprongkrachtBankTrainingsschema.Text;;
			s.Commentaar = txtSprongkrachtBankCommentaar.Text;

			DBManager.updateSnelheidMetBal(s);

			//lvi.Text = s.Tijd1.ToShortTimeString();
			lvi.Tag = s.Tijd1.ToShortDateString();	

			lvi.Tag = s;
			lvi.Selected = true;
		} 

This post has been edited by TomVdV: 28 May 2009 - 02:01 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Listview Update Data

#2 Jayman   User is offline

  • Student of Life
  • member icon

Reputation: 423
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Listview Update Data

Posted 28 May 2009 - 10:50 AM

Yes, you will need to clear and repopulate with data.
Was This Post Helpful? 1
  • +
  • -

#3 TomVdV   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 28-May 09

Re: Listview Update Data

Posted 29 May 2009 - 12:38 AM

thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1