Jump to content

Recommended Posts

Posted

Hi All,

 

I've run into a problem and I thought I'd throw it open to some people more clever than I!

 

Basically I have created my own 'ConfigKeys' object that under the hood uses a Generic List(of ConfigKey) to do the datastore.

I have a vb.net UI, with a datagridview that uses my object as a datasource.

 

My problem is that if I add a new ConfigKey to the ConfigKeys list using my object model, the datagridview doesn't show the newly added item, even if I call datagridview.refresh.

 

Here's some pseudo VB.net code:

 

private function doAdd()

***oUser.ConfigKeys.add(new ConfigKey("name","value")

***datagridView1.refresh()

end function

 

The wierd thing is that if I put a breakpoint on the line after the refresh() and query the oUserConfig keys count, it's correct, but the datagridgridview.rows count is 1 less.

The only way I've gotten the grid to update is to disconnect the datasource and reconnect it...

 

private function doAdd()

***oUser.ConfigKeys.add(new ConfigKey("test","key", "etc")

***datagridView1.datasource = nothing

***datagridView1.datasource = oUser.ConfigKeys()

end function

 

The grid is still definately connected to the datasource - if I change one of the config keys through the configKeys model, then the grid will show the changes.

I'm guessing there's something I need to do in my object model to tell any databound items that the size of the items has changed??

 

Any ideas? It's been a while since I've worked on something like this.

 

Thanks in anticipation.

Richard.

 

 

 

 

More...

 

View All Our Microsoft Related Feeds

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...