DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Formatting content of Inputboxes

  1. #1
    Join Date
    Jun 2005
    Location
    Boca Raton, Florida, USA
    Posts
    11

    Formatting content of Inputboxes

    Gentlemen:

    I am back with an annoying matter.

    I can't find how to improve the formatting of the content of a inputbox:

    For example how can I improve the following.

    InputBox("What are the Points to be paid on this loan if any - Please enter a number from 1 to 99?")

    How can I change the font, and size, and make it bold???
    Respectfully,
    Herman Ortiz

  2. #2
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    The input box is so limited that I do not of any commercial application using it. There is no way to format or validate the input, or catch the Cancel. This is from MSDN:
    Note Remember that when you use the InputBox function, you have little control over the components of the dialog box. You can change only the text in the title bar, the command prompt displayed to the user, the position of the dialog box on the screen, and whether or not it displays a Help button.
    It is possible to change the form by subclassing it, but it is so much of a pain that everyone prefer to roll their own one (easier, quicker and cleaner)
    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  3. #3
    Join Date
    Jun 2005
    Location
    Boca Raton, Florida, USA
    Posts
    11
    Dear Mstraf:

    Thank you again for joining this simple topic, but I do not understand your ending comment.

    How does one roll over his own????
    Respectfully,
    Herman Ortiz

  4. #4
    Join Date
    Jun 2005
    Location
    Philippines
    Posts
    22
    I think he meant everyone prefer to make their own rather than subclassing the inputbox

  5. #5
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    oh, sorry. I meant make a input box using a standard VB form, with a label, a textbox and two buttons. It can be enhanced with an image or whatever you can think of. Show it a vbModal, and add a to it a public property get InputText as String so you can get the input:

    dim frx as new MyInputBox
    frx.Prompt = "Enter the price:"
    frx.Show vbModal
    if len(frx.InputText) > 0 then
    '' do whatever

    This is just an idea.
    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  6. #6
    Join Date
    Jun 2005
    Location
    Boca Raton, Florida, USA
    Posts
    11
    Dear Trigshot & Mstraf:

    I have been playing around with a common dialog box, but so far I have not progressed much.

    I shall see if what Mr. Mstraf suggests I can learn about, and put into practice.

    To Trigshot:

    Your suggestion on the Tmp variables to Result variables has me resrtucturing the entire coding and just when I think I have it, I lose control over some other aspect of it. For example I created Clear cmd buttons with your concept whenever a variable is to be changed by the User (me) to examine its effects without re-entering all the factors. I am learning quite a bit with it.

    To Mstraf:
    I had found the MSDN definition of inputboxes and its limitations, but I still do not know how to change its location on the screen.

    In my earlier issue you suggested the use of a breakpoint, and lo and behold I had need for it today, and I discovered that while in process the mouse when placed over a variable or factor in the code displays its value. This has opened new doors for me in auditing my coding. Thanks.

    I use Outlook Express Drafts to store all the replies copied from this site, and I will study it.

    Thanks again to both.
    Respectfully,
    Herman Ortiz

  7. #7
    Join Date
    Feb 2004
    Location
    Sydney, Australia
    Posts
    498
    As Marco was suggesting, if you want a more sophisticated 'input' box, create your own. Set up a form
    make an input box using a standard VB form, with a label, a textbox and two buttons.
    [Label.caption set to whatever 'question' you want the user to answer, textbox to contain their 'answer', and two buttons (Ok and Cancel).
    Then you can position this form wherever you want it (unlike Input box), and you only need to pass either (a) two public properties - get InputText as String and Question as String, and one to indicate 'Ok' or 'Cancel' or (a) some Global variables to do the same.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center