473,394 Members | 1,738 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,394 software developers and data experts.

Adding Items to the combobox from the second form

Hello,

I have two forms (Form1 and Form2) . Form1 contains one Combobox and a button
which calls the second form on on_click event. In second form I have a
textbox and
a button. on click of this button i want to add a item in the Form1's
combobox.

How do i do this using c# in windows application. I am currently using
vs.net 2003.

Please Help.
--
With Regards,
Raghavendra Mudugal
Nov 17 '05 #1
3 2462
In article <86**********************************@microsoft.co m>,
"Raghavendra Mudugal" <Ra****************@discussions.microsoft.com>
wrote:
I have two forms (Form1 and Form2) . Form1 contains one Combobox and a button
which calls the second form on on_click event. In second form I have a
textbox and
a button. on click of this button i want to add a item in the Form1's
combobox.

How do i do this using c# in windows application. I am currently using
vs.net 2003.


Add a public method to Form1 which will add a string to a combo box. You
can then call this method from Form2, however you need to have a
variable for Form1 somewhere. Perhaps you can have a constructor for
Form2 that has a parameter for passing Form1 to it.
Nov 17 '05 #2
Hello Smith

I have gone through the reply which you have sent. could you please send the
sample code for this. Hope it will helps me a lot.

ManyThanks

"Matthew Smith" wrote:
In article <86**********************************@microsoft.co m>,
"Raghavendra Mudugal" <Ra****************@discussions.microsoft.com>
wrote:
I have two forms (Form1 and Form2) . Form1 contains one Combobox and a button
which calls the second form on on_click event. In second form I have a
textbox and
a button. on click of this button i want to add a item in the Form1's
combobox.

How do i do this using c# in windows application. I am currently using
vs.net 2003.


Add a public method to Form1 which will add a string to a combo box. You
can then call this method from Form2, however you need to have a
variable for Form1 somewhere. Perhaps you can have a constructor for
Form2 that has a parameter for passing Form1 to it.

Nov 17 '05 #3
Hello Smith

I have worked in the way you said, like creating new sub for adding item into
combobox and its modifier is public. but still it is not working. Is there any
other alternate i can see it for working?

Hope to receive your response soon.

Many Thanks

"Matthew Smith" wrote:
In article <86**********************************@microsoft.co m>,
"Raghavendra Mudugal" <Ra****************@discussions.microsoft.com>
wrote:
I have two forms (Form1 and Form2) . Form1 contains one Combobox and a button
which calls the second form on on_click event. In second form I have a
textbox and
a button. on click of this button i want to add a item in the Form1's
combobox.

How do i do this using c# in windows application. I am currently using
vs.net 2003.


Add a public method to Form1 which will add a string to a combo box. You
can then call this method from Form2, however you need to have a
variable for Form1 somewhere. Perhaps you can have a constructor for
Form2 that has a parameter for passing Form1 to it.

Nov 17 '05 #4

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: DraguVaso | last post by:
Hi, I have a ComboBox of +- 15.000 items in it, via a DataSource. On Top of the Items-list, I want to add some values, based on a user choise (via a filter on the DataSource). Does anybody know...
5
by: Tim | last post by:
I have block of code adding values to dropdown list under if (!Page.IsPostBack) { adding items } else { refreshing data }
1
by: Marco Roberto | last post by:
Hi, is there anyway to add itens into a combobox after this control be bound with a dataset? Regards, Marco
6
by: vb | last post by:
Hi, I am new to .Net. I am using a Combo Box in my windows forms. I am adding the items by creating the instances and adding the same to the list. My questions/doubts are: 1. If I have 25 to...
6
by: Juan Pedro Gonzalez | last post by:
I wanted to add a Combobox to a toolbar... Kind of the look you get on VisualStudio's toolbar. I've been able to find some VB 6 samples, but the placeholder option is no longer available for...
9
by: Don | last post by:
Is there any way to detect when an item has been added to the Items collection of a combobox or listbox? I am inheriting a Combobox and want to validate items before they are added to the...
34
by: bitsnbytes64 | last post by:
Hi, I've been having a similar issue to what is described in the "refresh a form" post with a ComboBox that is not being refreshed after adding a new value on a seperate form. The second form is...
3
by: =?Utf-8?B?Y2RtdW5veg==?= | last post by:
I have created a sub routine to programmatically add an indefinite number of combo boxes to a form. The combo boxes are bound in code to a view for displaying the available options. This routine...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...

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.