Question:
Visual Basic 6 Code?
2007-06-17 17:20:12 UTC
I am writing a program in Visual Basic 6, and I would like to open a dialog box through a menu option. What code would do this for me (the form I want to open is called frmAbout)
Three answers:
?
2007-06-17 17:44:54 UTC
VB6 uses the commonDialog control which is used to display dialog boxes for Colors, Fonts, Opening Files, Saving Files, Help and printer selection



You will need to add the component (ctrl+T) to your project by checking Microsoft Common Dialog 6.0 (SP3), Then you add this control object to your form. This control isnot displayed until one of its show methods is activated.



You can call these methods from any event handler (button or menu) or function.





If you want to open one of your other forms in your project then you can create a new instance of the form assigned to a variable and call a show method



Dim myFrm as New frmAbout



myFrm.show



You can use vbModal in the method to open the form modally



myFrm.Show(vbModal,Me) ' me is defined as the owner of the modal form
rod
2007-06-17 18:00:43 UTC
Mark (answer 1) is absolutely correct as usual. But I read the question differently. Though you mentioned a 'dialog box' I think you're just talking about opening a form, rather than opening a method of changing fonts, colors, etc.



If that's true, then simply create your menu. Assume your menu contains a listing for "About". In the code for mnuAbout, simply put:

frmAbout.show



You can add the Modal/modeless setting as Mark described depending on if you want to force closing of the About form before the user does anything else.



frmAbout.hide or frmAbout.Unload will get rid of the form
?
2016-05-18 05:47:31 UTC
Log-in ID I am assuming you are meaning, it is not exactly clear what you are asking. But if it is on the load event for your application have it trigger and load a dialog to prompt the user for their log-in and password, this will return those values to your main application for verification. You will have to code these yourself. Including the look up in whatever database of password reference system you define yourself.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...