Solved

VB.NET 2003 InputBox doesn't resize to fit its text

Posted on 2007-04-04
5
567 Views
Last Modified: 2008-02-01
In a VB.NET 2003 WinForm application, I get input from the user using the InputBox method. The problem is that the text in the InputBox doesn't fit (I have about 7 lines of text). It looks like the InputBox dialog is of fixed size and does not resize to fit its text. Does anyone know how to solve this?

The code is:

Dim sText As String

sText = InputBox ("Please contact us at:" & vbCrLf & vbCrLf & "Tel: (012) 345 6789" & vbCrLf & "Fax: (012) 345 6789" & vbCrLf & "E-Mail: someone@somewhere.com" & vbCrLf & "Website: www.mysite.com"

Thanks
0
Comment
Question by:SETP
  • 3
  • 2
5 Comments
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 500 total points
ID: 18849678
You should *not* be using the InputBox function in any .NET application.  You should design your own input form, which you can then control completely, to interact with the user, and request information.

AW
0
 

Author Comment

by:SETP
ID: 18850197
Thanks for your reply Arthur_Wood. So there's no .NET equivalent for the VB6 InputBox at all? That seems like a step back...
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 18850726
InputBox was a *kluge* that IMHO should never have been included in VB, from the very beginning.  No, as far as I am aware, there is no fully .NET version.  The InputBox that you are using is accessed via the Microsoft.VisualBasic namespace.  The real problem with the InputBox is that the returned value is *always* a String, even when the user enteres Numbers. And you cannot easily request Dates, or anything else from the user.  It also makes validation of the user entry very cumbersome, since you must write the validation code in the calling routine, and if the user made an invalid entry, then you must redisplay the InputBox.  That type of validation is much cleaner and more specific if you create your own input form, do the necessary validation, in the code of the form, and only return valid results to the caller.

AW
0
 

Author Comment

by:SETP
ID: 18850859
Makes sense... Thanks Arthur
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 18851223
glad to help.  Designing your ouw forms is much better, in terms of how your application interacts with the end users.  It just makes the application look more 'professional'.

AW
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

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

20 Experts available now in Live!

Get 1:1 Help Now