[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Controlling Size of VB5 InputBox

Posted on 1998-06-11
6
Medium Priority
?
408 Views
Last Modified: 2010-05-03
In VB5 the InputBox Function will allow you to display a Title, a Prompt, a Default response, and a screen position.
Is it also possible to control the Height and Width of the InputBox and the Width of the Text Box?

Sample Code:
 
  Title$ = "USER INPUT"
  Prompt$ = "Enter a Number From 1 to 9"
  Default$ = "1"
  X = 1000
  Y = 1000
  Entry = InputBox(Prompt$, Title$, Default$, X, Y)
 
When this is executed, an input box appears on the screen which is much larger than I would like.  The text box where the user is supposed to enter a number from 1 to 9 is wide enough for a 50 digit number!  Is there any way to make it smaller?  Also is there any way to change the font in the Title, Prompt or Text Box?

If these changes are not possible, then does anyone have some code to simulate this input box in a way that these properties (height, width, textbox width and font) can be controlled?
0
Comment
Question by:dougr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Expert Comment

by:marti
ID: 1463173
You could just create a small VB form to get this done.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1463174
marti is right, InputBox is a simple solution, but not a very flexible one. If you want something more then it can provide you, you must create your own form
0
 
LVL 9

Accepted Solution

by:
cymbolic earned 100 total points
ID: 1463175
It's really a trivial task to create your own form, but even then you would need to put some editing logic on your input text field if you wanted to restrict it just to numbers of less that two digits.  Since the input box needs sufficient size to display your prompt as well, you are going to have a larger than desired text entry area.  A simple solution is to place your input box call in a loop that edits for desired input characteristics, and re-requests until nothing is entered, or an acceptable entry is made.  It's still programmatically cheaper than rolling your own form!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dougr
ID: 1463176
cymbolic

I am a relative newcomer to Visual Basic, so what is a "trivial task" for some is somewhat more daunting for me.

Just so I am clear on what you are saying, I gather that it is impossible to:
  1. Change the size of an InputBox
  2. Change the Text Box width (of an InputBox)
  3. Change the Font within the text Box (of an InputBox)

Re creating a small VB Form, I still haven't mastered multiple forms - e.g. how to open several at once, how to handle mouse activity outside the form, which is front and back etc.

The solution I tend to use is to create a frame containing controls which simulate an InputBox (heading, buttons, labels etc).  I just render it visible when I need it and invisible when I don't

It takes a bit of code to do this, so I just thought there might be a more elegant solution - perhaps API's.  

dougr
0
 

Author Comment

by:dougr
ID: 1463177
cymbolic

I am a relative newcomer to Visual Basic, so what is a "trivial task" for some is somewhat more daunting for me.

Just so I am clear on what you are saying, I gather that it is impossible to:
  1. Change the size of an InputBox
  2. Change the Text Box width (of an InputBox)
  3. Change the Font within the text Box (of an InputBox)

Re creating a small VB Form, I still haven't mastered multiple forms - e.g. how to open several at once, how to handle mouse activity outside the form, which is front and back etc.

The solution I tend to use is to create a frame containing controls which simulate an InputBox (heading, buttons, labels etc).  I just render it visible when I need it and invisible when I don't

It takes a bit of code to do this, so I just thought there might be a more elegant solution - perhaps API's.  

dougr
0
 

Author Comment

by:dougr
ID: 1463178
Sorry, I got an error message from Experts Exchange when I submitted my comment, so I submitted it again.  That's why it appears twice.

dougr
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

656 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