473,401 Members | 2,127 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,401 software developers and data experts.

Combobox not refreshing when linking to dataset

I have a combobox that is contained within a user control.

Whilst the application is running, I'm attaching the combobox to a new
dataset. The problem I'm getting is that the combobox doesn't appear to
reflect the new dataset. The same code seems to work fine if the combobox
is set to the dataset on initialisation. What have I done wrong?

The code in full that I'm using to update the dataset and attach to the
combobox is as follows (the object jtmp is a link to a properietary
database, but I can see it cycling through this correctly).

dct = jtmp.ExtractDA(LookupAmc).DCount(m_DmsControl.VM)d t = New DataTable
ds = New DataSet
dv = New DataView
dt.TableName = "Data"
dt.Columns.Add("Id", System.Type.GetType("System.String"), "")
dt.Columns.Add("Description", System.Type.GetType("System.String"), "")
ds.Tables.Add(dt)
dv = ds.Tables("Data").DefaultView
Dim dr As DataRow
For cnt = 1 To dct
Try
If jtmp.Extract(m_LookupAmc, cnt).StartsWith("*") = False Then
Try
dr = dt.NewRow
dr.Item("Id") = cnt
dr.Item("Description") = jtmp.Extract(m_LookupAmc, cnt)
dt.Rows.Add(dr)
Catch
End Try
End If
Catch
End Try
Next cnt
dv.Sort = "Description"
txtLookup.ValueMember = Nothing
txtLookup.DataSource = Nothing
txtLookup.DisplayMember = Nothing
txtLookup.DisplayMember = "Description"
txtLookup.ValueMember = "Id"
txtLookup.DataSource = dv
txtLookup.Refresh()
Any clues as to what I've done wrong?

Thanks in advance

Simon
Nov 21 '05 #1
2 1871
Simon,

I think that you first of all have to remove all the code that you created
around your code to suppress the showing of all normal errors (without any
action at all).

Than the next problem can be done, however as you show it, have you
declared your usercontrol as bellow? Otherwise the code should not work in
my opinion or you should have created a lot of extra properties..

txtLookup as control
inherits Combobox

Is that true?

Cor
Nov 21 '05 #2
The usercontrol inherits from System.Windows.Forms.UserControl - this is because the usercontrol also has a button on it as well.

I've put some traps in the "catch" areas of my try/catch/end try to make sure it's not hitting an error, which it doesn't appear to be.

I'm not sure why not inheriting from UserControl should in itself cause a problem, surely this is how the usercontrol is supposed to work?

Regards
Simon
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:eO**************@TK2MSFTNGP11.phx.gbl...
Simon,

I think that you first of all have to remove all the code that you created
around your code to suppress the showing of all normal errors (without any
action at all).

Than the next problem can be done, however as you show it, have you
declared your usercontrol as bellow? Otherwise the code should not work in
my opinion or you should have created a lot of extra properties..

txtLookup as control
inherits Combobox

Is that true?

Cor

Nov 21 '05 #3

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

Similar topics

3
by: Wayne Wengert | last post by:
I am trying to populate a combobox with a lisy of items. I want the 1st item to be "Make a Selection" and the following items will be names from a table in my DB (See code below). When I run the...
6
by: Omar | last post by:
When I try to databind my comboBox (specifically field "emplcode") to a filled dataset , the contents of the comboBox displays a bunch of "System.Data.DataRowView". I assume the amount of times...
5
by: Dirk Meusel | last post by:
I use several Comboboxes on my Windows Forms that are programmed with VB.NET and VS 2002. For reasons of convenience, the Comboboxes are filled by databinding them to a dataset. Everything works...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
1
by: fiaolle | last post by:
Hi The first set of source code is the class for a combobox in a grid, hopefully. In the second set of code we try to use the combobox class, but the grid is empty. I don't understand how this...
0
by: lv2compute | last post by:
I am having a problem with my datagridview. I have a small table that has two columns. The first column is bound to my dataset. The second column is a combobox. I add items to the combobox based on...
7
by: samoore33 | last post by:
I am trying to dynamically add items to a listbox or combobox. The items add to either, but when I look through those items, there is nothing there. If I choose an item, it shows up. Not sure...
4
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a...
13
by: honey99 | last post by:
Hi! I have to fix a problem in JSP.Actually,i have a JSP page say Ex1.jsp.In this Ex1.jsp i have an anchor tag which links into another JSP page i.e when i click on the link another pop-up window...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...
0
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,...
0
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...

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.