Creating popup in C# [closed]

浪尽此生 提交于 2019-12-11 15:09:27

问题


I want to create a popup in C# where there will be three dropdowns populated with values from Database, user will select the values and on click of Submit button on Popup the values the parent page will get updated as per the selected values.how to do it, can someone help me ?


回答1:


You have to create a new Form with the controls you want, and the events you want to fill them. You should call the form with .ShowDialog() to be modal, like a popup.

Once done, you only need to get the data on your main form. You can do that in real time with the change events on the controls of the popup (sending the selected data everytime you change it the value), or even using the FormClosing event of the popup to send the selected values before its closed, for example.




回答2:


In WPF there is a Popup. In winforms you have to implement it yourself (one possibility is to use ToolStripControlHost on the ToolStripDropDown, see implementation details here).

Often beginners misspell popup, while meaning modal window/form. If question is that basic, please use search (google -> "C# show modal form", it should bring you here).




回答3:


It will be better to use another form. So any type of content can be added to it according to your need.



来源:https://stackoverflow.com/questions/21179057/creating-popup-in-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!