Answered by:
C# inputbox

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 meRes_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 Wiki • Twitter • LinkedIn • ForumsBrowser- 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 PMModerator
All replies
-
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 Wiki • Twitter • LinkedIn • ForumsBrowser- 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 PMModerator -
Thanks for the reply,
the problem is that Interaction is not working in C # 2008.Wednesday, August 12, 2009 9:49 PM -
Did you add a reference to Microsoft.VisualBasic, and then add the using statement?
See this link. Read the whole page.
http://wiki.codinglight.com/Namespace.ashx
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • Twitter • LinkedIn • ForumsBrowserWednesday, August 12, 2009 9:51 PMModerator -
Also, see
http://www.codeproject.com/KB/edit/InputBox.aspx
John Grove - TFD Group, Senior Software Engineer, EI Division, http://www.tfdg.comWednesday, August 12, 2009 9:58 PM -
ThanksWednesday, August 12, 2009 10:02 PM
-
private void Sheet1_Startup(object sender, System.EventArgs e) { Application.InputBox("Prompt", "Title", missing, missing, missing, missing, missing, missing); }
This code is VSTO Excel Project...
http://vsto.tistory.comTuesday, May 24, 2011 3:18 AM