If statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sandezco
    New Member
    • Nov 2007
    • 9

    #1

    If statement

    I am trying to write an IF statement for the following directions;

    write an If statement to make sure that neither PriceTextBox nor SharesTextBox is equal to nothing. Inside this IF statement, add the line TotalTextBox.Te xt = "$" & SharesTextBox.T ext * PriceTextBox.Te xt to calculate the total value of the stocks holding.

    Can I do this?
    If value PriceTextBox => 0 Then
    value PriceTextBox.Te xt = PriceTextBox
  • opie
    New Member
    • Nov 2007
    • 15

    #2
    Originally posted by sandezco
    I am trying to write an IF statement for the following directions;

    write an If statement to make sure that neither PriceTextBox nor SharesTextBox is equal to nothing. Inside this IF statement, add the line TotalTextBox.Te xt = "$" & SharesTextBox.T ext * PriceTextBox.Te xt to calculate the total value of the stocks holding.

    Can I do this?
    If value PriceTextBox => 0 Then
    value PriceTextBox.Te xt = PriceTextBox

    If PriceTextBox = "" Or SharesTextBox = "" Then
    TotalTextBox.Te xt = "$" & Val(SharesTextB ox.Text) * Val(PriceTextBo x)
    End If

    Comment

    • lee123
      Contributor
      • Feb 2007
      • 556

      #3
      your code for this is wierd is the control of these text boxes named (value PriceTextBox ) or is it pricetextbox? and further more do you want the text box to read:(PriceText Box) or the value in the text box? because if it's the value then you want to do this

      Code:
      IF PriceTextBox => "" Then
      PriceTextBox.Value = PriceTextBox
      
      End IF
      lee123

      Comment

      • sandezco
        New Member
        • Nov 2007
        • 9

        #4
        Originally posted by opie
        If PriceTextBox = "" Or SharesTextBox = "" Then
        TotalTextBox.Te xt = "$" & Val(SharesTextB ox.Text) * Val(PriceTextBo x)
        End If

        Thanks for the help! Got this error when I added the code;
        Overload resolution failed because no accessible '=' can be called with these arguments:
        'Public Shared Operator =(a As String, b As String) As Boolean': Value of type 'System.Windows .Forms.TextBox' cannot be converted to 'String'.

        Comment

        Working...