Help with code

if urltxt.text.contains “https” then
label2.text = “SAFE”
label2.textcolor =
label2.text = “Unknown”
label2.textcolor =
end if

I get three errors on this code. First:
it says my if urltxt (that is a combobox).text.contains “https” is incorrect code. It says my and are also incorrect.

Sam, what happens when you replace it with this code?

  if instr(0, urltxt.text, "https") > 0 then
    label2.text = "SAFE"
    label2.textcolor = &C00ff00 // green
    label2.text = "Unknown"
    label2.textcolor = &cff9c00 // orange
  end if

Alwyn beat me to it. :slight_smile:

The reasons your code doesn’t compile are:

  • contains is not a keyword in Xojo. You can add it with a package like my free M_String module, but it is not native.
  • is not a constant that returns the color green. Instead, when you have a color, it returns the value of the green component of that color.
  • doesn’t exist at all, so Alwyn gave you the constant values to use for both orange and green.

Thanks guys, that works. Big help!