WinForm newb and databinding

WinForm newb and databinding

Old forum URL: forums.lhotka.net/forums/t/5684.aspx


decius posted on Monday, October 27, 2008

Really frustrated here, and i feel like a real newb struggling with this.  I've always been a WebForm guy, but I've recently found a need for myself to learn WinForm development.  I've been using Csla for a good while now, but I'm pulling my hair out with refreshing the winform UI properly with a DataGridView:

I have a button that invokes my BO's Get and sets the bindingSource1.DataSource = myObject.  Trouble is, the UI doesn't update until the button is clicked twice! Very confusing.  I can't seem to understand why, as I've wasted most of the day trying to research this :(  Oddly enough, I've stepped through the code, and the dang DataSource will contain values on the first click! but they don't show up on the UI!

the current code for the onclick event of the fetchList button:

private void btnGet_Click(object sender, EventArgs e)

{

this.bindingSource1.RaiseListChangedEvents = false;

_cowList = CowList.GetCowList(txtSponsorId.Text, txtAuthId.Text);//where _cowList is a global property

this.bindingSource1.DataSource = _cowList;

this.bindingSource1.RaiseListChangedEvents = true;

}

 

 

 

 

decius replied on Monday, October 27, 2008

::sigh:: please disregard this post.  My appologies.  The problem that I was having was because I am using some custom controls that my office uses and they were conflicting with the DataGridView.  again, sorry for the nonesense post.

Copyright (c) Marimer LLC