Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   Code Library (http://www.xtremevbtalk.com/code-library/)
-   -   Making Custom Prompt Forms like MessageBox (http://www.xtremevbtalk.com/code-library/163046-custom-prompt-forms-messagebox.html)

Iceplug 04-24-2004 01:33 PM

Making Custom Prompt Forms like MessageBox
1 Attachment(s)
Here are some sample VB.NET form classes for making prompts in your program.

In each .vb file, you will find the Form class is not shown directly, but is shown by the second class, making a .ShowDialog call to the Form class:
Public [COLOR=Blue]Overloads Shared [/COLOR] Function Show() As Integer Dim NB As NumberBox Dim X As Integer NB = New NumberBox 'Instantiates the prompt numberbox 'If OK was pressed, there's something waiting for me in the .MyValue property. If NB.ShowDialog() = DialogResult.OK Then 'Shows the form. X = NB.MyValue 'Get it. Else X = -1 '-1, the default value. End If 'Return the value that we get. Return X 'You might find the other show functions are very similar to this one. 'Also, the other classes have show functions similar to this. 'Good luck. End Function
So, for each .vb file:
There is a class with multiple Shared Show functions.
These show the prompt form, using the New constructor to initialize the form (we do provide parameters for those multiple Shared Show functions, so they must be passed to the form)
The DialogResults are set for the OK and Cancel Button...
When the OK button is pressed, the prompt form data is written into RetVal (get this using .MyValue from the multiple Shared Show functions)
and from the Show function, the result is returned.

Enclosed are the NumericBox (selecting a number from a prompt),
the ArrayBox (selecting an array member from a prompt),
and the StringBox (like the InputBox where you type in a string from the prompt).
Good luck and enjoy!

All times are GMT -6. The time now is 11:48 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.