By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,763 Members | 1,641 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,763 IT Pros & Developers. It's quick & easy.

Data bound listbox not updating...

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.