|
-
Jul 24th, 2007, 10:08 AM
#1
Thread Starter
PowerPoster
[RESOLVED] C# equivalent of InputBox
My VB code would be:
TotPmts = Cint(InputBox("How many monthly paymwents will you make?"))
What would be the C# equivalent of that? Unfortunately my "Visual C# 20005" manual only uses console apps as their illustrations. I don't think "Readline" is what I am looking for.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Jul 24th, 2007, 10:31 AM
#2
Thread Starter
PowerPoster
Re: C# equivalent of InputBox
OK. I found a sample showing the creation of a form for user input. I created it (called InputBox). It has a field called txtUserInput on it.
My forms invokes it using the following code:
InputBox ib = new InputBox();
ib.Text = "What is your monthly payment?";
ib.ShowDialog();
string result = ib.txtUserInput;
ib.Dispose();
I get this error message (highlighting the ib.txtUserInput statement):
'TVAL.InputBox.txtUserInput' is inaccessible due to its protection level I:\VB NET Source Code\C#\TVAL\TVAL\TVAL\Form1.cs 1213 32 TVAL
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Jul 24th, 2007, 10:38 AM
#3
Re: C# equivalent of InputBox
You are trying to put the actual TextBox control into a string.
You want to put its Text into the string.
Code:
string result = ib.txtUserInput.Text;
-
Jul 24th, 2007, 10:57 AM
#4
Thread Starter
PowerPoster
Re: C# equivalent of InputBox
I got it figured out. I missed a "get" statement.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Jul 27th, 2007, 12:18 PM
#5
New Member
Re: [RESOLVED] C# equivalent of InputBox
you actually can use a real input box in C#
add a reference to Microsoft.VisualBasic
Microsoft.VisualBasic.Interaction.InputBox("prompt","title","default response",xPos,yPos)
-
Jul 27th, 2007, 12:49 PM
#6
Thread Starter
PowerPoster
Re: [RESOLVED] C# equivalent of InputBox
If I am going to continue using "VB" code inserts, I might as well continue using VB.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|