Solved

Vb.Net - Input Box

Posted on 2013-06-12
4
333 Views
Last Modified: 2013-06-12
Good Day Experts!

I have an inquiry about using the InputBox in VB.Net.  It comes pre-populated with the Ok and Cancel buttons.  All the examples I have found for determining that the Cancel button was clicked is based off of nothing being typed in and Ok clicked if something was typed in.  

How can I determine which button was actually clicked in the event the User entered something and then wanted to Cancel?

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
4 Comments
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 167 total points
ID: 39241001
You'll need to create your own input box in order to know this. The InputBox method only returns a string, and it does not give you any access to the underlying form that is displayed. It is unlike the MsgBox method that returns a DialogResult which you can interrogate for a user's action.
0
 
LVL 42

Assisted Solution

by:sedgwick
sedgwick earned 166 total points
ID: 39241012
long story short u can't.
InputBox is something derived from VB6 so you better use custom dialog box which u implement yourself and can handle any button u decide.
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 167 total points
ID: 39241480
Agreed.  There were hacks available in VB6 that allowed you to differentiate, but those do not work in VB.Net due to the new architecture.

Build your own "input dialog"...
0
 

Author Closing Comment

by:Jimbo99999
ID: 39242021
Thanks everyone...I better get to work.

jimbo99999
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now