创建一个接受文本值的子窗体 [英] Create a child form which accepts a text value

查看:75
本文介绍了创建一个接受文本值的子窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问问是否有某种方法可以使表格像Messagebox一样在我们调用show时返回一个字符串(例如输入的密码).
生成的表单的行为应类似于调用表单的子表单.我的意思是,当显示子表单时,应禁用调用表单,并在其上方放置子表单
谢谢您.

I want to ask if there is some way to make a form just like Messagebox that returns a string (say entered password)when we call show.
the resulting form should behave like a child form of the calling form. I mean when the child form is displayed the calling form should be dissabled with the child form over it
Thank you

推荐答案

是的,您将按照您所说的去做.在设计器中创建一个新的表单类,添加文本框和一个属性以返回其文本,然后创建其实例作为主表单的子级.使用ShowDialog()模态显示它以获得所需的行为.

我认为这意味着您可能会从购买Winforms上的书中受益.
Yes, you would do exactly what you said. Create a new form class in the designer, add the textbox and a property to return it''s text, and then create an instance of it as a child of your main form. Show it modally with ShowDialog() in order to get the behaviour you require.

I think this means you would probably benefit from buying a book on Winforms.


这篇关于创建一个接受文本值的子窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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