Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's hard to say with the provided information and I don't understand exactly what you are doing but a few things seems wrong there. </p> <h2>The <em>you lost me</em> part</h2> <p>Let's look at this first : </p> <pre><code>Dim rectangle As Integer rectangle = Val(TextBox1.Text) TextBox1.Text = Convert.ToString(rectangle) Form2.RectangleShape1.Width = Val(TextBox1.Text) </code></pre> <ul> <li>So you declare an integer</li> <li>Take the text of some textbox and select only the numbers from it by taking out characters</li> <li>You assign back that value in the Textbox with a <code>ToString()</code> on the Integer</li> <li>You assign the value of the textbox once again taking out characters (you already did that)</li> </ul> <p>You can resume this line with :</p> <pre><code>Form2.RectangleShape1.Width = CDbl(Val(TextBox1.Text)) </code></pre> <p>I changed the conversion to doubles because I'm certain you want decimals. Integers can't have decimals. Without decimals, these two conditions would be <strong>the exact same thing</strong> :</p> <pre><code>If Val(TextBox1.Text) &gt;= 1.0 Or Val(TextBox1.Text) &lt;= 1.5 Then Form2.RectangleShape1.Width = 75 End If If Val(TextBox1.Text) &gt;= 1.5 Then Form2.RectangleShape1.Width = 120 End If </code></pre> <p>Since you can either have 1 or 2. (So checking if it's between 1 and 1.5 OR 1.5 and 2 is pointless).</p> <h2>Val</h2> <p>You probably know this but <a href="http://msdn.microsoft.com/en-us/library/k7beh1x9%28v=vs.80%29.aspx" rel="nofollow">val</a> will return the numbers in a string. So as I asked in the comments, why don't you prevent the user from inputting something else than numbers ? </p> <p>Let's say <strong>you</strong> want to have this as result : <code>"&lt; 0"</code>.</p> <ul> <li>If you prevent letter and symbol he will have to input only <code>"0"</code></li> <li>If you do it like you're doing right now he will input <code>"&lt; 0"</code> the val function will only return <code>"0"</code> so telling me you need the <code>"&lt;"</code> is against your current logic.</li> </ul> <h2>But I want the number and the symbol...</h2> <p>Don't worry. If you are make sure the user will only input what you want (by putting restriction on the possible characters to input), you can catch the whole content of the textbox.</p> <pre><code>If myTextBox.Text = "&lt; 1.5" Then 'Do something cool Else If myTextBox.Text = "&lt; 0" Then 'Do something cooler Else 'Do nothing End If </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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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