473,748 Members | 4,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3040
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*******@yaho o.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.publi c.dotnet.langua ges.vb
| NNTP-Posting-Host: 69-163-11-6.kntnny.adelph ia.net 69.163.11.6
| Path:
cpmsftngxa10.ph x.gbl!TK2MSFTNG XA03.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP0 9
phx.gbl
| Xref: cpmsftngxa10.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:254998
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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
1610
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 contain data and the third links them together. The dataset has a constraint setup as well. The first listbox and the first and last name text box are bound to the Person DataTable. As you select a name in the listbox, the textbox will be...
1
6788
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" , MENU_ENTRY_ID = "MenuEntryId"; private void populateMenu() {
1
1795
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, etc... then update the db with the new contents of the listbox after the user clicks on a Save button. Not sure exactly how to do this. Any suggestions? Thanks.
1
1209
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 BindingContext to accomplish this but I think I am doing something wrong: Dim bc As BindingManagerBase = BindingContext(MyClass) bc.SuspendBinding() MyClass.Remove(ListBox1.SelectedItem) bc.ResumeBinding()
3
3843
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 of the datatable. I set the SelectionMode property to MultiExtended. I am able to load and select multiple lines in the listbox but I can not figure out how to retrieve both columns for each line selected in the listbox. I know that there is...
0
1689
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 the listbox with no luck and, because it is already bound, I can't just delete the item directly from the listbox without an error (because it already has a datasource, you are not allowed to delete/add anything to the listbox directly). The...
1
6434
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 for the non-foreign key fields. When the user clicks on a row in the listbox, the comboboxes' SelectedItem changes to reflect the foreign key selections in the currently selected row. That part is working fine. I also want the textboxes to change to...
0
1850
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 per line (this is in order to make the process of adding new IDs easy, since it's only done at time of configuration). I have no problem with retrieving the contents of the textBox, splitting it into a string array, validating the individual...
0
1287
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; http://msdn.microsoft.com/en-us/library/ms229603.aspx It clearly states, "When you use data binding, the data in your control is synchronized with the data source during execution of the Validating event. If you cancel the Validating event, the data will not be synchronized with the data source."...
0
9367
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8241
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4599
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.