Forum  General Visual ...  Let's Chat Abou...  InputBox
Previous Previous
 
Next Next
New Post 1/30/2010 10:23 PM
  osmosis311
383 posts
3rd Level Poster


InputBox 

Hi,

I know that we currently cannot use InputBox since VWG is asynchronous...

BUT, wouldn't it be easy for Gizmox to add the same functionality?  Create a basic form with a label and a textbox, and then provide a parameter for a callback, similar to how you handle MessageBoxes.  So when we call the InputBox, the form is displayed with the title and the message passed in, and when the user clicks OK or Cancel, the callback function is called, and the DialogResult and the value of the TextBox is passed in.....

What do you think?

 

Thanks!
-Danny
 

 
New Post 2/3/2010 5:21 AM
  SplitMerge
75 posts
www.hrtms.com
No Ranking


Re: InputBox 

Danny,

We created our own... this is a trivial to create in VWG. Just create a form yourself with two buttons and a text box.

In our case, the InputBox form has this code:


    public partial class InputBox : Form
    {
        public InputBox(string Message, string HeadingText, string DefaultValue)
        {
            InitializeComponent();
            this.btnCancel.BorderStyle = BorderStyle.FixedSingle;
            this.btnCancel.BorderWidth = 1;
            this.btnCancel.FlatStyle = FlatStyle.Flat;

            this.btnOK.BorderStyle = BorderStyle.FixedSingle;
            this.btnOK.BorderWidth = 1;
            this.btnOK.FlatStyle = FlatStyle.Flat;

            this.lblInstructions.Text = Message;
            this.Text = HeadingText;
            this.txtValue.Text = DefaultValue;

        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.txtValue.Text = "";
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }

Then to use the inputbox, you just code this:

               {

            string NewFormName = "Form1";
          
            InputBox oInputBox = new InputBox("Enter the name for the new form:"
                 , "New Form", NewFormName);

            oInputBox.Closed += new System.EventHandler(this.NewFormNameInputBoxClosed);
            oInputBox.ShowDialog();

        }

        private void NewFormNameInputBoxClosed(object sender, EventArgs e)
        {
            InputBox oInputBox = sender as InputBox;   
           
            if (oInputBox.txtValue.Text == "") return ;

          // DO SOME MORE CODE HERE..

     }

 

Mitch

 

 
New Post 2/8/2010 10:53 PM
  palli
11189 posts
1st Level Poster




Re: InputBox 

Hi Danny,

I think InputBox is a VB.NET specific feature, if I remember correctly, and not a part of Windows Forms.

As Mitch points out, it's really easy to create one, thanks Mitch.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 3/15/2010 3:39 PM
  sbaxter
23 posts
No Ranking


Re: InputBox 

 Hi Danny,

Recently I submitted an InputBox class in the code snippets section. You can download the code with an example here.

 

Regards,

Scott.

 
New Post 3/15/2010 3:57 PM
  jayhobbs
1644 posts
1st Level Poster




Re: InputBox 

Hi Scott,

The code download link just brings up a picture http://www.visualwebgui.com/Portals/0/Codes/2in1.jpg

Cheers

Jay

 

 
Previous Previous
 
Next Next
  Forum  General Visual ...  Let's Chat Abou...  InputBox
Azure banner
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS