473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 3027
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: me | last post by:
I've included a picture below to show what I am trying to accomplish. It is best to copy/paste into notepad to get the spacing correct. I have a dataset that contains 3 tables. Two of the tables...
1
by: GeraldBauer | last post by:
I am experiencing some weird behaviors with the listbox and dataview. Here is a boiled down code snippet of what I am trying to do. <snippet> string MENUID = "MenuId" , ITEM = "Item" ,...
1
by: VB Programmer | last post by:
I have a listbox which is data bound to a query that incorporates several tables. I want to be able to update the listbox with new items (from another "master" listbox), remove existing items,...
1
by: Brian Mitchell | last post by:
Hello, I am trying to update my listbox whenever I remove something from the underlying datasource (IList). I understand that you must use the SuspendBinding and ResumeBinding methods of the...
3
by: David L Wright II | last post by:
I have a data bound listbox that I want to select multiple lines then process each line. I bound a two column datatable to the listbox and set the DisplayMember property to the appropriate column...
0
by: Dave | last post by:
Hi all, I have a listbox that is complex bound by an arraylist. The problem is that when I delete an object from the arraylist, the listbox does not reflect those changes. I tried refreshing...
1
by: Peter | last post by:
Hi, I'm trying to create a form that shows table rows in a listbox. Several comboboxes expand the foreign key fields into text values from the parent tables, and there are also some textboxes...
0
by: EricLondaits | last post by:
Hi, I have an ASP.NET page with a ListBox that is data bound to a table with a single field (it holds a list of valid IDs). The page also has a textBox into which you can add new valid IDs, one...
0
by: diff | last post by:
I am having trouble preventing a bound source from updating using event-driven validation. There is a very nice article on MSDN explaining this;...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.