Peter Kiers
asked on
The name 'InputBox' does not exist in the current context
Hi,
I have this error: The name 'InputBox' does not exist in the current context.
By making this methode:
private void cmuTitle_Click(object sender, EventArgs e)
{
string value = "";
if (InputBox.Show("Set Note's title", "title:", ref value) == DialogResult.OK)
{
gpclStNotes.Text = value;
}
}
Who can help me?
Peter
I have this error: The name 'InputBox' does not exist in the current context.
By making this methode:
private void cmuTitle_Click(object sender, EventArgs e)
{
string value = "";
if (InputBox.Show("Set Note's title", "title:", ref value) == DialogResult.OK)
{
gpclStNotes.Text = value;
}
}
Who can help me?
Peter
ASKER
I have looked up on the internet and found this:
using Microsoft.VisualBasic;
But still got the error.
P.
using Microsoft.VisualBasic;
But still got the error.
P.
ASKER
I even did this:
1>Right click on project in Solution Explorer and Click on Add Reference
2>Select Microsoft.VisualBasic
3>Click Ok
4. using Microsoft.VisualBasic
1>Right click on project in Solution Explorer and Click on Add Reference
2>Select Microsoft.VisualBasic
3>Click Ok
4. using Microsoft.VisualBasic
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
But I have read on several pages that it is possible!
Peter
Peter
ASKER
Oke I make my own custom form.
Peter
Peter
>>But I have read on several pages that it is possible!
Are you following the instructions there exactly? (They are in C# and not Visual Basic I hope).
Are you following the instructions there exactly? (They are in C# and not Visual Basic I hope).
The code you found is NOT using the VB.Net InputBox()...it must be a custom replacement.
The VB.Net InputBox() function:
http://msdn.microsoft.com/en-us/library/6z0ak68w(VS.90).aspx
...is just a wrapper for the legacy VB6 InputBox() function:
http://msdn.microsoft.com/en-us/library/aa445028(VS.60).aspx
Neither returns a DialogResult. Instead, it returns the value entered into the box. Hitting Cancel or the 'X' returns a blank string, and you can't differentiate whether the user cancelled the dialog or hit OK with no input.
InputBox() is part of Microsoft.VisualBasic, but is actually located in Microsoft.VisualBasic.Inte raction.
Project --> Add Reference --> Microsoft.VisualBasic.
Add "using Microsoft.VisualBasic;".
Now qualify it with "Interaction".
Here's a simple example:
The VB.Net InputBox() function:
http://msdn.microsoft.com/en-us/library/6z0ak68w(VS.90).aspx
...is just a wrapper for the legacy VB6 InputBox() function:
http://msdn.microsoft.com/en-us/library/aa445028(VS.60).aspx
Neither returns a DialogResult. Instead, it returns the value entered into the box. Hitting Cancel or the 'X' returns a blank string, and you can't differentiate whether the user cancelled the dialog or hit OK with no input.
InputBox() is part of Microsoft.VisualBasic, but is actually located in Microsoft.VisualBasic.Inte
Project --> Add Reference --> Microsoft.VisualBasic.
Add "using Microsoft.VisualBasic;".
Now qualify it with "Interaction".
Here's a simple example:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string name = Interaction.InputBox("Name: ", "Please enter your name...");
label1.Text = name;
}
}
}
Try to right-click over "InputBox" and see if you can see "Resolve"...