How to refresh combo-box

ProgMan

Well-known member
Joined
Nov 25, 2006
Messages
55
Location
UK
Programming Experience
3-5
Hi again,

Its kinda URGENT! :eek: So, please respond asap if you can...

I have some text boxes in my form that takes data and saves the data to the database.

There is a combo box at the bottom of the page that loads data from a specific field of a database.

Now, when I enter and save new data (using the textboxes), the cb doesn't show the newly entered data. I tried to refresh the combobox, refresh the form but nothing is working :( :( :(

It only works if I close the form and reload (which is normal).

FYI, the data loading in the combobox is done during design-time using datasource, datamember..these kinda things.

So, how can I make the combobox show the just added record (field)?

I've about an hour to come up with an answer :eek:

Thanks
 
ok...

Atleast its doing something...

I used the following codes
VB.NET:
[SIZE=2]combobox.DataSource = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2]combobox.DataSource = BindingSource1[/SIZE]

but now the cb shows (a couple of)

System.Data.DataRowView

:confused:
 
I also tried that like this

VB.NET:
[SIZE=2]combobox.DataSource = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2]combobox.DataSource = BindingSource1[/SIZE]
[SIZE=2]combobox.DisplayMember = [/SIZE][SIZE=2][COLOR=#800000]"id"[/COLOR][/SIZE]

In this case it only shows the old ones excluding the new added item :( :confused:
 
Ok, then let's try this to see whether it works or not

Table1TableAdapter.Fill(YourDataSet.Tables(0))

Well I can fill a datagrid with updated data using the tableAdapter. But I don't see any association between a combobox and a TableAdapter. But I'll try to look into your code later.

For now, my time is up. I gotta go now without making it :( (Perhaps I should've asked this earlier)

Anyway, thanks to everyone for your kind support :)

See you later :)
 
Back
Top