473,782 Members | 2,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listbox Problem

I have two virtually identical listbox controls on a tabPage in my
application. I bind a small datatable to each one when a new project
(my data) is selected from a treeview control (this works fine).

When I select the first project, the data is retrieved without a
problem and the datatables are properly bound to both listboxes. The
first listbox has a "SelectedIndexC hanged" event wired to it which
also works fine.

Now, here's the wierd part: When I select a different project, the
data is retreived and the datatables are properly bound to both
listboxes. HOWEVER, the first listbox doesn't show the data!!!!! The
data IS THERE, but it's invisible!!! You can even select an item, and
the select even fires properly with the correct data.

EVEN WIERDER is that if I un-wire the "SelectedIndexC hanged" event the
problem goes away!!!! Of course, now my select events don't work.

This is VERY strange.

Any help would be greatly appreciated.

Sincerely,
Glen Wolinsky
Nov 20 '05 #1
6 1336
Code might be nice...

-----Original Message-----
I have two virtually identical listbox controls on a tabPage in my

Nov 20 '05 #2
Hi Glen,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that when you change the datasource
from one table to another, the data will not show in the first listbox.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I can not reproduce the problem.
Here is my test code.
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.ListBox1.Dat aSource = Me.DataSet11.Cu stomers
Me.ListBox1.Dis playMember = "Address"
Me.ListBox2.Dat aSource = Me.DataSet11.Cu stomers
Me.ListBox2.Dis playMember = "CompanyNam e"
Me.OleDbDataAda pter1.Fill(Me.D ataSet11)
Me.OleDbDataAda pter2.Fill(Me.D ataSet11)
End Sub

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Me.ListBox1.Dat aSource = Me.DataSet11.Em ployees
Me.ListBox1.Dis playMember = "FirstName"
Me.ListBox2.Dat aSource = Me.DataSet11.Em ployees
Me.ListBox2.Dis playMember = "LastName"
End Sub

Private Sub ListBox1_Select edIndexChanged( ByVal sender As Object, ByVal
e As System.EventArg s) Handles ListBox1.Select edIndexChanged
MsgBox("ListBox 1_SelectedIndex Changed")
End Sub

Please apply my suggestion above and let me know if it helps resolve your
problem.

Also can you povide a simple reproduce sample for us to do further
troubleshooting ?

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #3
I fixed the problem by using the following code for both listbox
controls when initializing my form:

lbxAssignments. BindingContext = Me.BindingConte xt
lbxOtherAttys.B indingContext = Me.BindingConte xt

I have limited understanding as to what this does, but it fixed the
problem.

Thanks,
Glen

--------------------------
Numbers 6:24-26
--------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #4
"Glen" <an*******@nosp am.com> schrieb
I fixed the problem by using the following code for both listbox
controls when initializing my form:

lbxAssignments. BindingContext = Me.BindingConte xt
lbxOtherAttys.B indingContext = Me.BindingConte xt

I have limited understanding as to what this does, but it fixed
the problem.

Maybe this helps:
http://msdn.microsoft.com/library/de...chitecture.asp
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
Hi Glen,

Did the link Armin post help you?

If you still have any concern on this issue, please feel free to post here
and I will work on you with that.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #6
Yes, what I had time to go through was helpful.

Thanks,
Glen
--------------------------
Numbers 6:24-26
--------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
540
by: Brian | last post by:
Hi, All, I'm using MS.net 2003 and using a windows.forms.listbox control for my window application but I don't know why the Horizontal Scrollbar could NOT be shown even if I set HorizontalScrollbar = true. The text info in listbox already beyond its right edge. How can I see the hidden part info in listbox? here is a part of codes. ListBox.ValueMember = XX ListBox.DisplayMember = XXXX
5
3531
by: Bill | last post by:
I have have two list boxes. One is a listing of all possible variables. We'll call this listbox A. The other is a listing of all the selected variables. We'll call this listbox B. If a person double-clicks on one of the variables in listbox A it "moves" it to listbox B. What is going on behind the scenes is that the table that holds all these variables has a yes/no field call Print. When the user double clicks on the value it fires a...
2
3679
by: Simon P | last post by:
Hello group, I'm in desperate need of help. Here goes : I have the following tables : CONTACTS (ContactID, FirstName, LastName, Company, etc.), SHOWS (ShowID, ShowDescription) and SHOWDETAILS (links the previous tables together so not to have a many-to-many relationship -- has the ContactID and ShowID fields). I have a main form with a couple of listboxes which are used for querying the CONTACTS table. The results populate bound fields...
1
3212
by: Josema | last post by:
Hi to all, I have a class (persons) that derives from collection base: and another class (person) with this properties: -ID -Name When i have complete filled the object Persons with all the persons, i put each persons inside a ListBox following this:
1
2709
by: MrNobody | last post by:
Hi, I'm doing something where I add custom objects to a ListBox which have aToString() method overriden so it displays what I want. When adding instances of these custom objects to the ListBox I also put the same references in a Hashtable so my program can obtain and modify these objects without iterating through entire ListBox looking for what I want. The problem is though, when I update these objects the changes are not being reflected...
1
2267
by: yamne | last post by:
I have a problem. When I click in edit datagrid button I show two listbox and two button. I use two button to move data between two listbox. My problem is that I can't call the listbox in the button_click function because the only way to find the listbox is: (listbox)e.item.findcontrol What s the solution to this problem?
4
11497
by: Ron | last post by:
I've got a listbox that holds a list of groups. Users can select a group, hit the remove button and the group should be removed from the listbox. The only problem is that no matter which group you select, the first one in the listbox is always removed.(The listitem with an index of 0. Box is set to single selection mode) I've looked at multiple examples and they all do it this way. What's wrong? (variables are also being set to the values...
8
6387
by: nirdeshonline | last post by:
Hi, I have added a simple listbox in windows form under c# 2.0. It contains a collection of approx 10 strings as list items. Now when i resize the form whole listbox flickers. Please tell me any feasible solution, i need to use a checked listbox which also has same flickering problem on resize. Thanks & Regards
9
3249
by: zdrakec | last post by:
Hello all: Clearly, I'm not getting it! Here is the scenario: On a web page, I have two list boxen and a text box. The first listbox is populated at page load time (if it is not a postback). This listbox has AutoPostback = True. When the user selects an item from this list, the second listbox is populated with more items relevant to this selection. I am using an SQLDataSource web control for this. These items are headers. I want, when...
15
2372
by: Doogie | last post by:
I have a .net app that a user currently enters a number in a text box, hits a button and a data call is executed. She wants the ability to enter in multiple numbers (up to 100). So to make things look better visually for that, I created a listbox under the text box. She enters the number in the text box, clicks another button I added and the number is stored in the list box. Then my plan was to grab all those numbers from the list box...
0
9641
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7494
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
5378
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
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.