Reputation: 11
I need my user to enter the date of the transaction during the process of parameterizing the sql insert query. I thought of a popup window with a textbox, returning the date, as string maybe, but I faced many issues and I guess there is an easier way. Also I have to call this code many times, because each transaction have different parameters, but the date is always there. There is an input box I saw, but couln't really understand how it works. Thank you for your help. it's in C#.
Upvotes: 0
Views: 10658
Reputation: 31
Try this : InputBox
I'm using the InputBox in quite a few places. Here an example:
InputBoxResult InputDate = InputBox.Show("Please enter a Date:",
"Input Date",
DateTime.Today.ToString("dd.MM.yyyy"));
if (InputWorkspaceName.ReturnCode == DialogResult.OK)
{
RequestData(InputDate.Text);
}
Here Is the Result Class
public class InputBoxResult
{
public DialogResult ReturnCode;
public string Text;
}
Upvotes: 0
Reputation: 2073
One thing you can do, is reference Visual Basic's Input Box. You can do this by referencing it at the top;
using Microsoft.VisualBasic.Interaction;
and then accessing the input box object like so;
string yourReturnedValue = Microsoft.VisualBasic.Interaction.InputBox("Question", "Title", "Default", 0, 0);
This will prompt the user a MessageBox type box, but with an input field which you can assign to the variable, as shown in the example above - "yourReturnedValue"
More information can be found here; http://msdn.microsoft.com/en-us/library/6z0ak68w(v=vs.80).aspx
Upvotes: 2