1
Answer

Please help me how to implement the below functionality

Mp Raghava

Mp Raghava

7y
182
1
When i click on Delete in Gridview , it should display a comments box.
 
 
Answers (1)
3
Vulpes

Vulpes

NA 98.3k 1.5m 12y
There are various ways in which you could do this but perhaps the easiest way is this - I'm assuming the first form is called Form1, its combobox is called comboBox1 and it's been placed directly on Form1, not in some container such as a panel.

The following code should be added to button1_Click on Form2:

Form1 f1 = (Form1)Application.OpenForms["Form1"];
ComboBox cb = (ComboBox)f1.Controls["comboBox1"];
cb.Items.Add(textBox1.Text);

Accepted
0
Chandrakant Patil

Chandrakant Patil

NA 110 9.5k 9y
Hi Vulpes
can u please explain also other ways because this way is not suited for my problem. I have combobox in form1 which is binding from data source and on form2 i have a text box so when i click on save button on form2  the form1 combo box not refreshed says "Items collection not modified when the datasource property is set".
0
Alireza Saffari

Alireza Saffari

NA 2 0 10y
thanks a lot :)
0
Nel

Nel

NA 713 954.7k 12y
Thank you very much Vulpes:)
0
Nel

Nel

NA 713 954.7k 12y
Thank you very much Vulpes:)
0
Nel

Nel

NA 713 954.7k 12y
Thanks, but doesn't solve the problem
0
Hi , you put u r second form button1_click code in the second form form_load event and try...