View Single Post
Old 04-24-2004, 01:33 PM
Iceplug's Avatar
Iceplug Iceplug is offline

Retired Moderator
* Guru *
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Lightbulb Making Custom Prompt Forms like MessageBox

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!
Attached Files
File Type: zip (15.2 KB, 222 views)

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote