在 C# 中创建弹出窗口 [英] Creating popup in C#

查看:99
本文介绍了在 C# 中创建弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 C# 中创建一个弹出窗口,其中三个下拉列表填充了数据库中的值,用户将选择这些值,然后单击弹出窗口上的提交按钮,父页面的值将根据所选值进行更新.怎么做,有人可以帮我吗?

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 ?

推荐答案

你必须用你想要的控件和你想要填充它们的事件创建一个新的表单.您应该使用 .ShowDialog() 调用表单为模态,就像弹出窗口一样.

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.

完成后,您只需要获取主表单上的数据.您可以使用弹出窗口控件上的更改事件实时执行此操作(每次更改值时发送所选数据),甚至使用弹出窗口的 FormClosing 事件发送所选数据例如,关闭之前的值.

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.

这篇关于在 C# 中创建弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆