468,107 Members | 1,306 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

Data bound listbox not updating...

Hi. I have a form with a listbox and a few label fields all bound to a
dataset. When i navigate the listbox the labels change accordingly. so far
everything works good.

I made a button to delete a record. I delete the row from the datatable and
update the database with the adapter and that all works good. The record is
removed from the listbox.

Here is my problem.

I made another form to add a new record (has its own questions, input
fields, etc.). This form has its own connection, adapter and dataset
variables on it that it uses to add the new record. It works fine (adds the
new record to the actual database) but when I close that form and am now
back at the previous form (with the listbox), I cannot get the listbox to
update.

I've tried several suggestions from the web.

-re-filling the dataset (i.e. ds.clear() and then adapter.fill(ds,"table").
that did not work.

-Using the currencymanager's refresh() method from the dataset's
bindingcontext. That did not work.

-I've tried re-binding. as well as suspendbinding() and resumebinding().

I just don't understand it.

If I close that main form (the one with the listbox) and then go back into
it, it will now show the newly added record!! The form's startup has
nothing special that I didn't already try for refreshing it.

Any suggestions?

Thank you very much.
-Spock
Nov 21 '05 #1
1 2808
Hello Spock,

Have you tried 'Unbinding' the listbox completely, then rebinding to the
dataset?
Also, if you are using 2 dataset instances (1 on each form) the dataset on
teh original form needs to be refilled. you might try using 1 instance of
the dataset and passing it between the forms.
hope that helps

Steve Stein
VB Team

This posting is provided "AS IS" with no warranties and confers no rights.

--------------------
| From: "Spock" <sp*******@yahoo.com>
| Subject: Data bound listbox not updating...
| Date: Thu, 20 Jan 2005 14:06:14 -0500
| Lines: 41
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
| Message-ID: <O6*************@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.vb
| NNTP-Posting-Host: 69-163-11-6.kntnny.adelphia.net 69.163.11.6
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.languages.vb:254998
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Hi. I have a form with a listbox and a few label fields all bound to a
| dataset. When i navigate the listbox the labels change accordingly. so
far
| everything works good.
|
| I made a button to delete a record. I delete the row from the datatable
and
| update the database with the adapter and that all works good. The record
is
| removed from the listbox.
|
| Here is my problem.
|
| I made another form to add a new record (has its own questions, input
| fields, etc.). This form has its own connection, adapter and dataset
| variables on it that it uses to add the new record. It works fine (adds
the
| new record to the actual database) but when I close that form and am now
| back at the previous form (with the listbox), I cannot get the listbox to
| update.
|
| I've tried several suggestions from the web.
|
| -re-filling the dataset (i.e. ds.clear() and then
adapter.fill(ds,"table").
| that did not work.
|
| -Using the currencymanager's refresh() method from the dataset's
| bindingcontext. That did not work.
|
| -I've tried re-binding. as well as suspendbinding() and resumebinding().
|
| I just don't understand it.
|
| If I close that main form (the one with the listbox) and then go back into
| it, it will now show the newly added record!! The form's startup has
| nothing special that I didn't already try for refreshing it.
|
| Any suggestions?
|
| Thank you very much.
|
|
| -Spock
|
|
|

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by VB Programmer | last post: by
1 post views Thread by Brian Mitchell | last post: by
1 post views Thread by Peter | last post: by
reply views Thread by EricLondaits | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.