Results 1 to 10 of 10

Thread: [RESOLVED] How to get an InputBox control

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2020
    Posts
    18

    Resolved [RESOLVED] How to get an InputBox control

    i'm working on a project but i'm stuck on something, I want an InputBox to show when i select a particular value from a list of my combobox values. I added a picture of my combobox.
    Attached Images Attached Images  

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: How to get an InputBox control

    There is something called the InputBox, but it is so terribly restrictive that there is virtually no real world use for it. I suspect that you don't want that anyways....even if you think you might.

    So, what you want could be one of two things.

    1) A different form that pops up with a textbox on it (or some other type of control, if the data you want them to input isn't text).

    2) Since you have plenty of space on the form you are showing, perhaps you could just put the textbox or other control on there and toggle the Visibility property on or off, as you wish.

    Either way, you'd want to do that in the SelectedIndexChanged event handler for the combobox.
    My usual boring signature: Nothing

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: How to get an InputBox control

    An inoutbox isn't a control... it's a method baked into VB that you can call that will display a dialog asking the user for input. If you want to simply display information, then use MessageBox ... unless you meant something else...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Junior Member
    Join Date
    May 2020
    Posts
    18

    Re: How to get an InputBox control

    yes I want it to ask user for an input of their grades whiles button 2 is inactive .

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2020
    Posts
    18

    Re: How to get an InputBox control

    I prefer your second option but does it mean that for every value i select there should be textbox controls to allow the user an input?

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: How to get an InputBox control

    Not a different textbox, just one.

    However, there may be a better approach. I can't quite read the text in that control. If you have a series of items, and you want the user to be able to enter some value for each of the items, then perhaps the ComboBox isn't the right control. An alternative you might consider would be a DataGridView, where the first column is the item, and the second column would allow the user to enter a value. You couldn't collapse a DGV the way you can with a combobox, but it would allow the user to see the text and the values next to each other in two columns, which might be more appealing.

    The combobox and textbox seems a better route if the user will make one selection, enter a value, then leave the form. You could also have a textbox and for each selection, the user would see the value associated with that selection (if there is one), so that they could click on each one in turn and see the values. There are times when that would be nicer than the DGV approach. Of course, then you'd have to consider custom coloring of the items in the combobox to indicate whether or not they had a value, yet, but that's a whole different matter.
    My usual boring signature: Nothing

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: How to get an InputBox control

    Have a look at my custom dialog form...

    http://www.scproject.biz/Using%20Dialogs.php#bm11

  8. #8
    Lively Member
    Join Date
    Jan 2020
    Posts
    120

    Re: How to get an InputBox control

    HTML Code:
    Dim Message, Title, Default, MyValue
    Message = "Enter a value between 1 and 3"    ' Set prompt.
    Title = "InputBox Demo"    ' Set title.
    Default = "1"    ' Set default.
    ' Display message, title, and default value.
    MyValue = InputBox(Message, Title, Default)
    
    ' Use Helpfile and context. The Help button is added automatically.
    MyValue = InputBox(Message, Title, , , , "DEMO.HLP", 10)
    
    ' Display dialog box at position 100, 100.
    MyValue = InputBox(Message, Title, Default, 100, 100)

  9. #9

    Thread Starter
    Junior Member
    Join Date
    May 2020
    Posts
    18

    Re: How to get an InputBox control

    thank you @.paul.

  10. #10

    Thread Starter
    Junior Member
    Join Date
    May 2020
    Posts
    18

    Re: [RESOLVED] How to get an InputBox control

    thanks to everyone it helped

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width