By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,058 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,058 IT Pros & Developers. It's quick & easy.

If statement

P: 9
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.Text = "$" & SharesTextBox.Text * PriceTextBox.Text to calculate the total value of the stocks holding.

Can I do this?
If value PriceTextBox => 0 Then
value PriceTextBox.Text = PriceTextBox
Dec 5 '07 #1
Share this Question
Share on Google+
3 Replies


P: 15
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.Text = "$" & SharesTextBox.Text * PriceTextBox.Text to calculate the total value of the stocks holding.

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

If PriceTextBox = "" Or SharesTextBox = "" Then
TotalTextBox.Text = "$" & Val(SharesTextBox.Text) * Val(PriceTextBox)
End If
Dec 5 '07 #2

lee123
100+
P: 556
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:(PriceTextBox) or the value in the text box? because if it's the value then you want to do this

Expand|Select|Wrap|Line Numbers
  1. IF PriceTextBox => "" Then
  2. PriceTextBox.Value = PriceTextBox
  3.  
  4. End IF
lee123
Dec 5 '07 #3

P: 9
If PriceTextBox = "" Or SharesTextBox = "" Then
TotalTextBox.Text = "$" & Val(SharesTextBox.Text) * Val(PriceTextBox)
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'.
Dec 5 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.