Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As a couple of comments have mentioned, there really isn't enough information here to provide you with a useful answer. There are two main User Interface frameworks in .Net for windows applications. One of these is commonly referred to as "WinForms" and the other is "WPF" or "Windows Presentation Foundation." </p> <p>I'm going to go with you are most likely using WinForms as it is the older of the two technologies. The approach here can be used on both sides with a little tweaking. Setting text in a text box is very similar to setting text programaticly on a label. You can get more detail on that on MSDN: <a href="http://msdn.microsoft.com/en-us/library/bb383971%28v=vs.90%29" rel="nofollow">How to: Display Text on a Windows Form</a>; <a href="http://msdn.microsoft.com/en-us/library/bb397491%28v=vs.90%29" rel="nofollow">How to: Use TextBox Controls to Get User Input</a>.</p> <p>If you are using WPF the "back end" code is pretty much the same. You just need to make sure your textbox has an <code>x:Name="userInputTextBox"</code> so you can reference it in your code behind. <strong>Be mindful</strong> that your users can input "1", "3" or "abcd" in the field. Ensuring your app doesn't bomb is most likely outside of the assignment but feel free to look up C# <code>int.TryParse(...)</code> and "Try Catch" :-) </p> <p>Your button handler could look like this:</p> <pre><code>void btnUserClick_Click(object sender, System.EventArgs e) { int userValue; if(int.TryParse(txtUserInput.Text, out userValue)) { // We have the value successfully, do calculation } else { // We don't have the users value. MessageBox.Show("Please enter a valid integer into the text box.") } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload