0

if I write 500 in a textbox then a label.caption show "Profit". If I write -500 the the label.caption show Loss. I write code

If Format(Text1, "0000000") Then Label1.Caption = "Profit"

but for -500 what I need to write?

3
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by Vineeth K
0
If Val(Text1.Text) < 0 Then
  Text1.Text = "-" & Text1.Text
Else
  '...

Good Luck

Edited by vb5prgrmr: n/a

1

You can do it by one line , if you get the Profit base to a variable then

Dim a As Integer
a = 500
If Text1.Text <= a Then Label1.Caption = "Loss" Else Label1.Caption = "Profit"
Votes + Comments
SolVed
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.