locked
C# inputbox RRS feed

  • Question

  • Hello,


        I have a doubt, I try to ask the user a value in VB, I used the inputbox.
    but in C # can not do this. if someone can help me

     Res_max= MessageBox.Show("O number max is " + num_max_itens +". Do you need update this values","Max value", MessageBoxButtons.YesNo, MessageBoxIcon.Question );

                       if (Res_max_ == DialogResult.Yes)
                       {
                           num_max_itens= inputbox("Ask the user for new value");

                       }

    Thanks

    Wednesday, August 12, 2009 9:37 PM

Answers

  • There's no equivalent in C#.  You can either create a custom form that will do this for you, or you can add a reference to Microsoft.VisualBasic, and then use code such as the following:

    using Microsoft.VisualBasic;

    namespace Test
    {
        internal class Program
        {
            public static void Main()
            {
                Interaction.InputBox("Do you need to update the values?", "Max Value", string.Empty, -1, -1);
            }
        }
    }


    Coding Light - Illuminated Ideas and Algorithms in Software
    Coding Light WikiTwitterLinkedInForumsBrowser
    • Proposed as answer by Joshua Bylotas Wednesday, August 12, 2009 9:53 PM
    • Marked as answer by Ricardo M.S. _ Wednesday, August 12, 2009 10:02 PM
    Wednesday, August 12, 2009 9:42 PM
    Moderator

All replies