473,799 Members | 3,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update Combobox Contents

Hi:
I have a combobox (in form 1) whose items are populated from a table. In
form 2 there is a data entry for the same table. How do I reflect the
changes to the combobox in form 1 as soon as the data entered in form 2 is
saved in the table? Thanks in advance.
Nov 16 '05 #1
2 3860
Hi,

One way to accomplish this is rebind the data in the combobox in an event
that fires upon completion of the data entry. This way the combobox will
reflect the changes of the data entered on your form.

I hope this helps.

Nov 16 '05 #2
First of all I write a class in a seperate file as this
using System;

using System.Windows. Forms

public class Watcher

{

private System.Windows. Forms.ComboBox combo;
public Watcher()

{

}

public Watcher(ref System.Windows. Forms.ComboBox cb)

{

this.combo = cb;

}
public void AddItem()

{

this.combo.Item s.Add("SerhaD") ;

}

}

Both Form1 and Form 2 have an instance of this class. In The Form 1 it is a
private, Form2's is public member

//////In your Form1.comboBox fill function do

watcherForm1 = new Watcher(ref comboBox1);

//////while constructing Form2 Do this

Form2 f2 = new Form2();

f2.watcherForm2 = watcherForm1;

fe.ShowDialog() ;

/////// In the Form2 you may call AddItem function of Watcher Class

watcherForm2.Ad dItem(); //this adds SerhaD to the combo

////Turn to the Form1 and Look at the Combo and that's it

SerhaD is added to the Combo from Form2 !

Hope you get the idea ,



"A. Chiou" <A. Ch***@discussio ns.microsoft.co m> wrote in message
news:F3******** *************** ***********@mic rosoft.com...
Hi:
I have a combobox (in form 1) whose items are populated from a table. In
form 2 there is a data entry for the same table. How do I reflect the
changes to the combobox in form 1 as soon as the data entered in form 2 is
saved in the table? Thanks in advance.

Nov 16 '05 #3

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

Similar topics

1
3834
by: noone | last post by:
I'm making a sales order database similar to Northwinds but with a slightly different form. The tables are the same. The 'Sales Orders' form has a 'Line Items' subform. I've added a 'Add Item' button to the master form 'Sales Orders'. Clicking the button will bring up a popup window'Search' ( a continuous form). A combo box on the 'Search' form header lets the user select which category of product he wants to choose from. The...
1
2137
by: thomaz | last post by:
When i make an update in my database, the modifications are showing in all TEXTBOX but i can´t see the new values in a combobox text. If i close the form and open it again the new values will appear in the combobox text. How can i see the values in a COMBOBOX text after an update without closing and opening the form ??? Thanks...
2
12888
by: John Tyce | last post by:
When a button is clicked, a date is inserted or added into a combo box like this : ComboBox.Items.Add(string) or ComboBox.Items.Insert(0,string); Either way, the new string does not show up in the ComboBox. I get no errors or problems, it just will not work. At load time I am retrieving dates from an Oracle database and adding them to the ComboBox with out any problems. However, once the application is up and running I cannot add to the...
9
4778
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and DataSet; and all I'm doing is showing one record in text fields, allowing the user to modify the text fields, and then updating the database again when the user clicks the Save button. The fields already show the correct data record since I have...
9
3226
by: ukjock | last post by:
I am very new to the whole Visual Basic .net scene, and I am trying to get to grips with it... I thought I would try and learn a programming language, and I was advised on vb.net. I have already come across my first problem, of saving a combobox. I want to save the contents of a combobox and the reload the contents when the form re-loads. Any advise and any great Idiots guide website's? Thanks for your help
1
1149
by: fiaolle | last post by:
Hi I have tried to update my combobox with no luck. I add records to the table, the combobox has as Datasource, but I don't know how to update the combobox. I have tried updata the oledbadapter and the dataset and set the datasource to that dataset, but nothing happens. I can see in the database that I've added a new record to the table, but nothing happens to the combobox when I update it. Does anyone know how to solve this.
5
2602
by: njb35 | last post by:
Hi all I'm beginning my foray from VBA into VB 2005 Express, and enjoying some of the efficiencies it provides! I'm stuck with some dataset handling however that I _think_ can be automated but I can probably code what I want to do the hard way. I've searching around online but can't find an answer to this specific question. Here's the situation: I have a dataset table with 3 fields: one indexed as a primary key and the other two...
3
7525
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going on. It's a simple program that loads a control onto a form and binds "Foo" against a combobox ("SelectedItem") for it's "Bar" property and a datetimepicker ("Value") for it's "DateTime" property. The DateTimePicker.Visible value is set to...
0
2310
by: XenReborn | last post by:
Ok this should be simple. I made a form, added a combobox (for selecting items to edit, not for updating fields), several textboxes, a few checkboxes etc. On formshow it connects to my database, draws down the existing data, no problem. All the records in the datatable that were the result of a query, I could select from, and the other databound components would display the records contents, no problem..... however.... when i add a new row, the...
0
10260
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...
1
10243
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,...
0
10030
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...
1
7570
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
6809
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
5467
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
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
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
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.