Which form event should I use to pop up a login form?

佐手、 提交于 2019-12-13 10:36:02

问题


Before the user makes use of the main form, I want to pester them to enter their username, password, and siteNumber.

Should I invoke a ShowDialog on the login form from the Main form's Load(), Activated(), GotFocus(), or Validate() events? Or should I just invoke the login form from the main form's constructor?

This is a Windows CE app, and those are the only options I have, event-wise (there is no "Shown" event).


回答1:


Have you considered prompting via ShowDialog before you even get to the main form?

Put the code right in the Main() someplace before the Application.Run(new MainForm()).

Works fine, I've done this before.



来源:https://stackoverflow.com/questions/27867278/which-form-event-should-i-use-to-pop-up-a-login-form

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