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?

Recommended Answers

All 2 Replies

If Val(Text1.Text) < 0 Then
  Text1.Text = "-" & Text1.Text
Else
  '...

Good Luck

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"
commented: SolVed +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.