DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Mattias Sjögren Guest

    Re: How do you make an InputBox in C#

    Max,

    >It was easy for me to find System.Windows.Forms.MessageBox.Show() to get the
    >MsgBox to pop up, but how do you get the InputBox?


    Create a Form with a Textbox, two Buttons and a Label on it.


    Mattias

    ===
    Mattias Sjögren (VB MVP)
    mattias @ mvps.org
    http://www.msjogren.net/dotnet/

  2. #2
    max caber Guest

    How do you make an InputBox in C#


    It was easy for me to find System.Windows.Forms.MessageBox.Show() to get the
    MsgBox to pop up, but how do you get the InputBox?
    Thanks

  3. #3
    Patrick Steele [MVP] Guest

    Re: How do you make an InputBox in C#

    In article <3d06571b$1@10.1.10.29> (from max caber
    <maxcaber@yahoo.com>),
    >
    > It was easy for me to find System.Windows.Forms.MessageBox.Show() to get the
    > MsgBox to pop up, but how do you get the InputBox?


    You could always use the one from VB.NET if you don't want to make one
    yourself:

    using System;
    using System.Windows.Forms;
    using System.Drawing;
    using Microsoft.VisualBasic; // include VB.NET functions

    class MainForm : Form
    {
    private Button m_Button;

    public MainForm()
    {
    Text = "This is my form";
    m_Button = new Button();
    m_Button.Size = new Size(60,30);
    m_Button.Location = new Point(5,5);
    m_Button.Text = "Show";
    m_Button.Click += new EventHandler(show_inp);

    this.Controls.Add(m_Button);
    }

    public void show_inp(object sender, EventArgs e)
    {
    string str = Interaction.InputBox("Prompt", "Title", "<def>", 30, 40);
    }

    public static void Main(string[] args)
    {
    Application.Run(new MainForm());
    }
    }

    --
    Patrick Steele
    Microsoft .NET MVP

  4. #4
    max caber Guest

    Re: How do you make an InputBox in C#


    Patrick Steele [MVP] <patrick@mvps.org> wrote:

    using Microsoft.VisualBasic; // include VB.NET functions
    //other code
    string str = Interaction.InputBox("Prompt", "Title", "<def>", 30, 40);
    //more code

    Are the classes in the Microsoft.VisualBasic namespace part of the ECMA standard?
    Max

  5. #5
    Patrick Steele [MVP] Guest

    Re: How do you make an InputBox in C#

    In article <3d0761cc$1@10.1.10.29> (from max caber
    <maxcaber@yahoo.com>),
    >
    > Patrick Steele [MVP] <patrick@mvps.org> wrote:
    >
    > using Microsoft.VisualBasic; // include VB.NET functions
    > //other code
    > string str = Interaction.InputBox("Prompt", "Title", "<def>", 30, 40);
    > //more code
    >
    > Are the classes in the Microsoft.VisualBasic namespace part of the ECMA standard?


    I doubt it. It's my understanding that the ECMA standard is on the C#
    language, not any particualr set of namespaces.

    --
    Patrick Steele
    Microsoft .NET MVP

  6. #6
    max caber Guest

    Re: How do you make an InputBox in C#


    Patrick Steele [MVP] <patrick@mvps.org> wrote:

    >I doubt it. It's my understanding that the ECMA standard is on the C#
    >language, not any particualr set of namespaces.


    I read that the ECMA standard was on the C# language and the .NET API. If
    you go to http://www.go-mono.com/, you will see the progress evolving with
    the open source implementation of the .NET class libraries and C# compiler.

    As for VB.NET, when there is a .NET class/method that performs the same function
    as a "built in VB command", I choose the .NET class/method because it is
    more portable across languages and future platforms.

    I do appreciate all the responses to my original question, "How do you make
    an InputBox in C#?", but I would like to find a .NET class/method that does
    this.


  7. #7
    max caber Guest

    Re: How do you make an InputBox in C#


    "Michael \(michka\) Kaplan" <former_mvp@nospam.trigeminal.spamless.com> wrote:
    >As many have said before, there is not one.
    >
    >But you should feel free to keep asking and getting back the same answer
    >until you understand. :-)


    Responses to my question demonstrated ways to manually create a Form containing
    a TextBox and Buttons, and how to use a VB.NET class to show an InputBox.
    However, you are the first to inform me that, "there is not one” (a .NET
    ECMA standard class/method to show an input box). Thank you for providing
    me with this surprising information.

    I do have to admit that I am a little taken back, because there has been
    an InputBox Function in VB since I can remember, there is one in JavaScript,
    and Java. How could the .NET people have forgotten such a simple, useful,
    practical thing, when they thought of everything else?


Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links