is this value in a listview really an integer?

christie
04-15-2003, 04:07 AM
Hi,
i want to check if a value from my listview is really an integer:


strtemp = "0'" & lvMyList.ListItems(i)
If (CStr(CInt(strtemp)) <> Trim(lvMyList.ListItems(i))) Then
Check_Values = -1 'not an integer!!!!
Exit Function
End If

but this does not work:(
does anybody have idea's?

ps: loopuing through the listview is not a problem, only the check

Squirm
04-15-2003, 04:46 AM
If IsNumeric(lvMyList.ListItems(i).Value) And InStr(1, lvMyItems(i).Value, ".") = 0 Then
'Its an integer
End If

jEEm
04-15-2003, 04:46 AM
Hi

Perhaps you can try this instead of your If-test:

If IsNumeric( lvMyList.ListItems(i) ) Then

JEEm

christie
04-15-2003, 04:58 AM
Tried both solutions mentioned here, and as always: simple is best:
numeric(lvblah.listitems(i)) is the only solution which works bugfree....

both squirm and my own solution try to catch _all_ possibilities,
and those just won't compile (sorry squirm)

easy is best ;)
thanx!

Squirm
04-15-2003, 05:13 AM
Okay it should have been:

If IsNumeric(lvMyList.ListItems(i).Text) And InStr(1, lvMyItems.ListItems(i).Text, ".") = 0 Then
'Its an integer
End If

You should try to avoid relying on default object properties.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum