Select all text inside InputBox textbox





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







-1















How do I programmatically select all in vb.net InputBox?



 Dim ans As String
Dim iznos As String = gridRacun.SelectedItem("kol")
ans = InputBox("Enter value:", "Amount", 1111)
If ans = "" Then
ans = iznos
ElseIf System.Text.RegularExpressions.Regex.IsMatch(ans, "[^0-9,-]+") Then
ans = iznos
ElseIf Convert.ToDouble(ans) <= 0 Then
ans = iznos
Else
ans = ans
End If


I want InputBox.textbox.selectall() so the user does not need to select all or delete all if he wants a value that is not already input.










share|improve this question


















  • 1





    You don't. InputBox is a function, not an object, so trying to access amember of it is nonsensical. Don't use InputBox at all, ever. Create your own form and put a TextBox control on it and then you can treat that like a TextBox... because it is a TextBox.

    – jmcilhinney
    Jan 4 at 9:56











  • So, why does InputBox selects everything if i call inputbox like this: a = InputBox("Input value", "Delete number", 30)

    – stacks
    Jan 4 at 9:59











  • @stacks I guess who ever coded the implementation of Inputbox thought that if you have default value set (ie. 30) it would be easier for the user to change that if the text is already selected, hence you can just start typing the new value. But as for the question, do what jmcilhinney said.

    – Esko
    Jan 4 at 10:04











  • If I run the code InputBox("Enter value:", "Amount", 1111) in a newly created form, the default text "1111" is selected. Doesn't that work for you? But honestly, InputBox is crap, better create your own form - the extra effort is minimal, and you have much better control over it.

    – Doc Brown
    Jan 4 at 10:04













  • Yeah, i guess it is way much better to make my own control. Thanks for help guys.

    – stacks
    Jan 4 at 10:08


















-1















How do I programmatically select all in vb.net InputBox?



 Dim ans As String
Dim iznos As String = gridRacun.SelectedItem("kol")
ans = InputBox("Enter value:", "Amount", 1111)
If ans = "" Then
ans = iznos
ElseIf System.Text.RegularExpressions.Regex.IsMatch(ans, "[^0-9,-]+") Then
ans = iznos
ElseIf Convert.ToDouble(ans) <= 0 Then
ans = iznos
Else
ans = ans
End If


I want InputBox.textbox.selectall() so the user does not need to select all or delete all if he wants a value that is not already input.










share|improve this question


















  • 1





    You don't. InputBox is a function, not an object, so trying to access amember of it is nonsensical. Don't use InputBox at all, ever. Create your own form and put a TextBox control on it and then you can treat that like a TextBox... because it is a TextBox.

    – jmcilhinney
    Jan 4 at 9:56











  • So, why does InputBox selects everything if i call inputbox like this: a = InputBox("Input value", "Delete number", 30)

    – stacks
    Jan 4 at 9:59











  • @stacks I guess who ever coded the implementation of Inputbox thought that if you have default value set (ie. 30) it would be easier for the user to change that if the text is already selected, hence you can just start typing the new value. But as for the question, do what jmcilhinney said.

    – Esko
    Jan 4 at 10:04











  • If I run the code InputBox("Enter value:", "Amount", 1111) in a newly created form, the default text "1111" is selected. Doesn't that work for you? But honestly, InputBox is crap, better create your own form - the extra effort is minimal, and you have much better control over it.

    – Doc Brown
    Jan 4 at 10:04













  • Yeah, i guess it is way much better to make my own control. Thanks for help guys.

    – stacks
    Jan 4 at 10:08














-1












-1








-1








How do I programmatically select all in vb.net InputBox?



 Dim ans As String
Dim iznos As String = gridRacun.SelectedItem("kol")
ans = InputBox("Enter value:", "Amount", 1111)
If ans = "" Then
ans = iznos
ElseIf System.Text.RegularExpressions.Regex.IsMatch(ans, "[^0-9,-]+") Then
ans = iznos
ElseIf Convert.ToDouble(ans) <= 0 Then
ans = iznos
Else
ans = ans
End If


I want InputBox.textbox.selectall() so the user does not need to select all or delete all if he wants a value that is not already input.










share|improve this question














How do I programmatically select all in vb.net InputBox?



 Dim ans As String
Dim iznos As String = gridRacun.SelectedItem("kol")
ans = InputBox("Enter value:", "Amount", 1111)
If ans = "" Then
ans = iznos
ElseIf System.Text.RegularExpressions.Regex.IsMatch(ans, "[^0-9,-]+") Then
ans = iznos
ElseIf Convert.ToDouble(ans) <= 0 Then
ans = iznos
Else
ans = ans
End If


I want InputBox.textbox.selectall() so the user does not need to select all or delete all if he wants a value that is not already input.







vb.net






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 4 at 9:53









stacksstacks

728




728








  • 1





    You don't. InputBox is a function, not an object, so trying to access amember of it is nonsensical. Don't use InputBox at all, ever. Create your own form and put a TextBox control on it and then you can treat that like a TextBox... because it is a TextBox.

    – jmcilhinney
    Jan 4 at 9:56











  • So, why does InputBox selects everything if i call inputbox like this: a = InputBox("Input value", "Delete number", 30)

    – stacks
    Jan 4 at 9:59











  • @stacks I guess who ever coded the implementation of Inputbox thought that if you have default value set (ie. 30) it would be easier for the user to change that if the text is already selected, hence you can just start typing the new value. But as for the question, do what jmcilhinney said.

    – Esko
    Jan 4 at 10:04











  • If I run the code InputBox("Enter value:", "Amount", 1111) in a newly created form, the default text "1111" is selected. Doesn't that work for you? But honestly, InputBox is crap, better create your own form - the extra effort is minimal, and you have much better control over it.

    – Doc Brown
    Jan 4 at 10:04













  • Yeah, i guess it is way much better to make my own control. Thanks for help guys.

    – stacks
    Jan 4 at 10:08














  • 1





    You don't. InputBox is a function, not an object, so trying to access amember of it is nonsensical. Don't use InputBox at all, ever. Create your own form and put a TextBox control on it and then you can treat that like a TextBox... because it is a TextBox.

    – jmcilhinney
    Jan 4 at 9:56











  • So, why does InputBox selects everything if i call inputbox like this: a = InputBox("Input value", "Delete number", 30)

    – stacks
    Jan 4 at 9:59











  • @stacks I guess who ever coded the implementation of Inputbox thought that if you have default value set (ie. 30) it would be easier for the user to change that if the text is already selected, hence you can just start typing the new value. But as for the question, do what jmcilhinney said.

    – Esko
    Jan 4 at 10:04











  • If I run the code InputBox("Enter value:", "Amount", 1111) in a newly created form, the default text "1111" is selected. Doesn't that work for you? But honestly, InputBox is crap, better create your own form - the extra effort is minimal, and you have much better control over it.

    – Doc Brown
    Jan 4 at 10:04













  • Yeah, i guess it is way much better to make my own control. Thanks for help guys.

    – stacks
    Jan 4 at 10:08








1




1





You don't. InputBox is a function, not an object, so trying to access amember of it is nonsensical. Don't use InputBox at all, ever. Create your own form and put a TextBox control on it and then you can treat that like a TextBox... because it is a TextBox.

– jmcilhinney
Jan 4 at 9:56





You don't. InputBox is a function, not an object, so trying to access amember of it is nonsensical. Don't use InputBox at all, ever. Create your own form and put a TextBox control on it and then you can treat that like a TextBox... because it is a TextBox.

– jmcilhinney
Jan 4 at 9:56













So, why does InputBox selects everything if i call inputbox like this: a = InputBox("Input value", "Delete number", 30)

– stacks
Jan 4 at 9:59





So, why does InputBox selects everything if i call inputbox like this: a = InputBox("Input value", "Delete number", 30)

– stacks
Jan 4 at 9:59













@stacks I guess who ever coded the implementation of Inputbox thought that if you have default value set (ie. 30) it would be easier for the user to change that if the text is already selected, hence you can just start typing the new value. But as for the question, do what jmcilhinney said.

– Esko
Jan 4 at 10:04





@stacks I guess who ever coded the implementation of Inputbox thought that if you have default value set (ie. 30) it would be easier for the user to change that if the text is already selected, hence you can just start typing the new value. But as for the question, do what jmcilhinney said.

– Esko
Jan 4 at 10:04













If I run the code InputBox("Enter value:", "Amount", 1111) in a newly created form, the default text "1111" is selected. Doesn't that work for you? But honestly, InputBox is crap, better create your own form - the extra effort is minimal, and you have much better control over it.

– Doc Brown
Jan 4 at 10:04







If I run the code InputBox("Enter value:", "Amount", 1111) in a newly created form, the default text "1111" is selected. Doesn't that work for you? But honestly, InputBox is crap, better create your own form - the extra effort is minimal, and you have much better control over it.

– Doc Brown
Jan 4 at 10:04















Yeah, i guess it is way much better to make my own control. Thanks for help guys.

– stacks
Jan 4 at 10:08





Yeah, i guess it is way much better to make my own control. Thanks for help guys.

– stacks
Jan 4 at 10:08












1 Answer
1






active

oldest

votes


















0














InputBox is a function, not a type. When you call InputBox, the code that the function contains will create a form and add the appropriate controls and other functionality to it. That includes a TextBox control. If you create your own form with a TextBox on it and set the Text in the designer, when you display that form you will find that the text in the TextBox is selected by default. That's exactly what happens with the form created by the InputBox method.



In your own form, you have access to the form itself and all the controls on it, so you can call SelectAll on the TextBox whenever you want. When you call InputBox, you have no access to the form or its controls so you can't make it behave any way other than the author of that method intended. Create your own form and you have full control over how it behaves and also how it looks. It's rare that the InputBox function actually creates a UI that fits aesthetically with the rest of an application.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54036551%2fselect-all-text-inside-inputbox-textbox%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    InputBox is a function, not a type. When you call InputBox, the code that the function contains will create a form and add the appropriate controls and other functionality to it. That includes a TextBox control. If you create your own form with a TextBox on it and set the Text in the designer, when you display that form you will find that the text in the TextBox is selected by default. That's exactly what happens with the form created by the InputBox method.



    In your own form, you have access to the form itself and all the controls on it, so you can call SelectAll on the TextBox whenever you want. When you call InputBox, you have no access to the form or its controls so you can't make it behave any way other than the author of that method intended. Create your own form and you have full control over how it behaves and also how it looks. It's rare that the InputBox function actually creates a UI that fits aesthetically with the rest of an application.






    share|improve this answer




























      0














      InputBox is a function, not a type. When you call InputBox, the code that the function contains will create a form and add the appropriate controls and other functionality to it. That includes a TextBox control. If you create your own form with a TextBox on it and set the Text in the designer, when you display that form you will find that the text in the TextBox is selected by default. That's exactly what happens with the form created by the InputBox method.



      In your own form, you have access to the form itself and all the controls on it, so you can call SelectAll on the TextBox whenever you want. When you call InputBox, you have no access to the form or its controls so you can't make it behave any way other than the author of that method intended. Create your own form and you have full control over how it behaves and also how it looks. It's rare that the InputBox function actually creates a UI that fits aesthetically with the rest of an application.






      share|improve this answer


























        0












        0








        0







        InputBox is a function, not a type. When you call InputBox, the code that the function contains will create a form and add the appropriate controls and other functionality to it. That includes a TextBox control. If you create your own form with a TextBox on it and set the Text in the designer, when you display that form you will find that the text in the TextBox is selected by default. That's exactly what happens with the form created by the InputBox method.



        In your own form, you have access to the form itself and all the controls on it, so you can call SelectAll on the TextBox whenever you want. When you call InputBox, you have no access to the form or its controls so you can't make it behave any way other than the author of that method intended. Create your own form and you have full control over how it behaves and also how it looks. It's rare that the InputBox function actually creates a UI that fits aesthetically with the rest of an application.






        share|improve this answer













        InputBox is a function, not a type. When you call InputBox, the code that the function contains will create a form and add the appropriate controls and other functionality to it. That includes a TextBox control. If you create your own form with a TextBox on it and set the Text in the designer, when you display that form you will find that the text in the TextBox is selected by default. That's exactly what happens with the form created by the InputBox method.



        In your own form, you have access to the form itself and all the controls on it, so you can call SelectAll on the TextBox whenever you want. When you call InputBox, you have no access to the form or its controls so you can't make it behave any way other than the author of that method intended. Create your own form and you have full control over how it behaves and also how it looks. It's rare that the InputBox function actually creates a UI that fits aesthetically with the rest of an application.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 4 at 13:18









        jmcilhinneyjmcilhinney

        26.5k32033




        26.5k32033
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54036551%2fselect-all-text-inside-inputbox-textbox%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas