Hi

I am developing a windows application.

For your infomation

FRONT END : C# (VISUAL STUDIO 2008)
BACKEND : SQL SERVER 2008

In a single form I have an option for add and remove books. Two different buttons are used(Add and Remove Books).

When I click on Add button the particular book name entered in the textbox is added to the database.

For Removing books I am using a combo box which is populated with the values from the database(the same table where the add button stores the book name).

Now when I add a particular book by clicking on the add button, now if I wish to remove the same book I have to close the form and again re-open it to remove it. If I dont close and re-open the newly entered book is not populated to the combo box.

In the add button I have included the following code to refresh the form

this.Refresh();

But still I am not able to do this.

Can anybody help me out in performing this task?

Thanks in advance!

This isn't a problem with refreshing the form. It sounds like you're populating the combo box from the database only when the form opens. You also should call this method after you add OR remove an item from the database. Can you upload a sample project or paste your code up here so we can take a look?

This isn't a problem with refreshing the form. It sounds like you're populating the combo box from the database only when the form opens. You also should call this method after you add OR remove an item from the database. Can you upload a sample project or paste your code up here so we can take a look?

Thanks a lot for your prompt reply.

Now it is working properly.

I'm glad you were able to solve your problem and good luck!

It is not necessary to refresh the form, its enough to refresh the control(combobox). Call Refresh method of the combobox you want to reload.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.