I'm having some trouble with a listbox on a Windows form.
Initially it populates fine. I have another listbox (listbox1) and when it's
index changes, listbox2 is repopulated.
I have a textbox that displays what is selected in listbox2.
It is rare that listbox2 has any data right now.
So if I click through listbox1, and there is no data to put in listbox2,
it's fine.
When I click on the first item in listbox1 that does have data to display in
listbox2, it's fine.
Then, when I move to another item in listbox1, my listbox2 never changes.
Whatever was displayed in there the 1st time, remains.
The wierd thing is, the textbox, that is populated with the code:
dim drv as datarowview
drv = Me.listbox2.SelectedItem
Me.txtbox1.Text = drv("STR_AMEND_NO").ToString
this displays the correct data...
and if there are supposed to be greater than 1 items in listbox2, but only 1
is displaying (from a previous selection), i can still click on 1 or 2 items
in listbox2 (even though I can't see them) and the correct data displays in
txtbox1.
I'm not sure if I've given enough information to go on here...but I'm very
frustrated!!
TIA!
Amber 5 1406
Amber,
For a listbox is at least important how you populate it.
Can you tell us that for both?
Cor
Hi Amber,
It seems to be that you are forgetting to clear the data in listBox2 when the item in listBox1 change, but as Cor said, please tell us how you populate your ListBoxes (code sample).
On Sat, 23 Jul 2005 00:45:01 +0200, amber <am***@discussions.microsoft.com> wrote: I'm having some trouble with a listbox on a Windows form.
Initially it populates fine. I have another listbox (listbox1) and when it's index changes, listbox2 is repopulated. I have a textbox that displays what is selected in listbox2. It is rare that listbox2 has any data right now. So if I click through listbox1, and there is no data to put in listbox2, it's fine. When I click on the first item in listbox1 that does have data to display in listbox2, it's fine. Then, when I move to another item in listbox1, my listbox2 never changes. Whatever was displayed in there the 1st time, remains. The wierd thing is, the textbox, that is populated with the code: dim drv as datarowview drv = Me.listbox2.SelectedItem
Me.txtbox1.Text = drv("STR_AMEND_NO").ToString
this displays the correct data... and if there are supposed to be greater than 1 items in listbox2, but only 1 is displaying (from a previous selection), i can still click on 1 or 2 items in listbox2 (even though I can't see them) and the correct data displays in txtbox1.
I'm not sure if I've given enough information to go on here...but I'm very frustrated!!
TIA! Amber
--
Happy coding!
Morten Wennevik [C# MVP]
What code would I use to clear my listbox?
I populate my listboxes as follows.
lboxCP = listbox1 in my previous post
lstAmendments= listbox 2
this sub is called whenever the index of listbox1 (lBoxCP) is changed:
Private Sub getCPAmends()
Dim permit As String
Dim drv As DataRowView
drv = lBoxCP.SelectedItem
permit = drv("ID_CUTTING_PERMIT")
_datasetAmend.Clear()
lstAmendments.DataSource = Nothing
_datasetAmend = _opmanager.getCPAmend(permit)
** note that here I call a function that uses MS Application Blocks add-in
to populate my dataset **
_dataviewAmend = New DataView(_datasetAmend
..Tables("vwCuttingPermitAmendApp"), "", "STR_AMEND_NO",
DataViewRowState.CurrentRows)
Me.lstAmendments.DataSource = _dataviewAmend
lstAmendments.DisplayMember = "STR_AMEND_NO"
Is this enough information??
TIA!
Amber
Amber,
Why not try what happens when you set this statement not in one line in its
constructor, however one by one by setting the properties. I think that it
makes your problem more clear _dataviewAmend = New DataView(_datasetAmend .Tables("vwCuttingPermitAmendApp"), "", "STR_AMEND_NO", DataViewRowState.CurrentRows)
Just my thought,
Cor
Hi amber,
I'm afraid I'm not sure what happens although I think I have heard of something similar before (at least regarding being able to select invisible items).
If you are running McAffee antivirus it might be worth trying to update it.
If the code is called by windows in an event it may also be that an exception is swallowed. Put the code inside a try catch block.
Since the question is related to databases/datasources you might want to try this newsgroup
microsoft.public.dotnet.framework.adonet
or the VB newsgroups
microsoft.public.dotnet.languages.vb
microsoft.public.dotnet.languages.vb.data
On Sat, 23 Jul 2005 23:09:02 +0200, amber <am***@discussions.microsoft.com> wrote: What code would I use to clear my listbox?
I populate my listboxes as follows. lboxCP = listbox1 in my previous post lstAmendments= listbox 2
this sub is called whenever the index of listbox1 (lBoxCP) is changed:
Private Sub getCPAmends()
Dim permit As String Dim drv As DataRowView
drv = lBoxCP.SelectedItem
permit = drv("ID_CUTTING_PERMIT") _datasetAmend.Clear()
lstAmendments.DataSource = Nothing
_datasetAmend = _opmanager.getCPAmend(permit) ** note that here I call a function that uses MS Application Blocks add-in to populate my dataset **
_dataviewAmend = New DataView(_datasetAmend .Tables("vwCuttingPermitAmendApp"), "", "STR_AMEND_NO", DataViewRowState.CurrentRows)
Me.lstAmendments.DataSource = _dataviewAmend lstAmendments.DisplayMember = "STR_AMEND_NO"
Is this enough information?? TIA! Amber
--
Happy coding!
Morten Wennevik [C# MVP] This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael Foord |
last post by:
Here's a little oddity with 'print' being a reserved word...
>>> class thing:
pass
>>> something = thing()
>>> something.print = 3
SyntaxError: invalid syntax
>>> print something.__dict__...
|
by: amber |
last post by:
Hello.
Can someone tell me what I may be doing wrong here?
I'm using the code (lboxRP is a listbox):
Dim newRPindex As Integer
newRPindex = Me.lboxRP.FindString(RP)...
|
by: Chris Leuty |
last post by:
I am populating a multiselect Listbox from a dataset, with the content of
the listbox filled by one table, and the selections determined from another
table. So far, I have been keeping the dataset...
|
by: Dave |
last post by:
Hi all,
After unsuccessfully trying to make my own dual listbox control out of
arraylists, I decided to look for a 3rd party control. I've looked for over
a week now and can't find anything but...
|
by: amber |
last post by:
I'm having some trouble with a listbox on a Windows form.
Initially it populates fine. I have another listbox (listbox1) and when it's
index changes, listbox2 is repopulated.
I have a textbox...
|
by: jmdocherty |
last post by:
All,
I've been trying to set up a CSS layout and all seems well in Firefox
but in Safari it just seems to be plain weird! I hope someone can help
tell me whether this is a problem with my code...
|
by: Ali Chambers |
last post by:
Hi,
I have created a listbox called "dtlist1" on my VB.NET form. I call a
procedure as follows:
Private Sub openfile(flname As String)
dtlist1.Items.Clear()
etc..
|
by: michael.f.ellis |
last post by:
The following script puzzles me. It creates two nested lists that
compare identically. After identical element assignments, the lists
are different. In one case, a single element is replaced. In...
|
by: Rex the Strange |
last post by:
Hello all,
Traditionally I'm a Delphi and VB6 programmer and have recently started
working with VB.NET (which, I might add, I love, but that's beside the
point). Anyway, I was trying to make a...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |