473,738 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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).DCou nt(m_DmsControl .VM)dt = New DataTable
ds = New DataSet
dv = New DataView
dt.TableName = "Data"
dt.Columns.Add( "Id", System.Type.Get Type("System.St ring"), "")
dt.Columns.Add( "Descriptio n", System.Type.Get Type("System.St ring"), "")
ds.Tables.Add(d t)
dv = ds.Tables("Data ").DefaultV iew
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("Descri ption") = jtmp.Extract(m_ LookupAmc, cnt)
dt.Rows.Add(dr)
Catch
End Try
End If
Catch
End Try
Next cnt
dv.Sort = "Descriptio n"
txtLookup.Value Member = Nothing
txtLookup.DataS ource = Nothing
txtLookup.Displ ayMember = Nothing
txtLookup.Displ ayMember = "Descriptio n"
txtLookup.Value Member = "Id"
txtLookup.DataS ource = dv
txtLookup.Refre sh()
Any clues as to what I've done wrong?

Thanks in advance

Simon
Nov 21 '05 #1
2 1894
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.UserContr ol - 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******** ******@TK2MSFTN GP11.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
7493
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 project, the combox box initially displays an empty selection. When I click on the drop down arrow I see the "Make a Selection" followed by the other choices. How can I move everything up so that the "Make a Selection" is the default value in...
6
7485
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 "System.Data.DataR..." is displayed inside the combobox is the amount of records in the dataset. On the other hand, if my query is "select emplcode from payemployee", the databind will work fine (but I don't want to limit the dataset to one field)....
5
1520
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 fine, except that all Comboboxes are by default marked (or better: the text shown is selected). Only after clicking once into each Combobox, they appear in the usual way unselected or unmarked. Its kind of nothing much important, but when i open a...
4
4619
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 bound to a table as a lookup, drawing values from another table to populate the available selections. This all worked fine in VB6. I have distilled the problem down to a simple form drawing data from the Northwind database for a representative...
1
2098
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 works. The first set of code I downloaded from internet and when i tried it, it worked fine. But when I changed the second part of the code it started to give me trouble. Before I changed the code they used Datacolumns,Datarows and Datatables and...
0
3174
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 the information that I get from a text file. I then try to set the value of the combobox to a specific value based on the first column. The code is working to set the value, but it will not refresh and display the selected value on the screen...
7
1908
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 why, but the items are not visible in the listbox or combobox until one of the items has been chosen. This of course is not good, since someone can not see the items they need to choose from. Any help would be appreciated.
4
6666
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 common/standard .NET control accepting an Object as a parameter type? In Web Forms, there is a ListItem object that can be passed in to add/retrieve objects from a DropDownItems collection. I searched Google groups, and all the solutions I'm finding...
13
7453
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 will open.My problem is the pop-up window and the parent window has same combobox.if i add data through html form in pop-up window(Ex2.jsp) it enters the combobox...but the data in the combobox of parent window(Ex1.jsp) is entering only when i refresh...
0
8787
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
9334
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
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8208
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...
0
6053
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
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
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
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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.