many commands have been deprecated

Instrb - “This item was deprecated in version 2019r2.” :slight_smile:

Out of the frying pan into the fire?

Stick this on a global module in your project, because if it were in the framework it would make many things ten times more complicated than they need to be.

Public Sub Add(extends toDict as Dictionary, vKey as Variant, assigns vValue as Variant)
  if toDict.HasKey(vKey) then
    dim ex as new UnsupportedOperationException
    ex.Message = "This key exists already, use the Value function."
    raise ex
    
  end
  
  toDict.Value(vKey) = vValue
End Sub

[quote=489065:@Tim Parnell]Stick this on a global module in your project, because if it were in the framework it would make many things ten times more complicated than they need to be.

[code]
Public Sub Add(extends toDict as Dictionary, vKey as Variant, assigns vValue as Variant)
if toDict.HasKey(vKey) then
dim ex as new UnsupportedOperationException
ex.Message = “This key exists already, use the Value function.”
raise ex

end

toDict.Value(vKey) = vValue
End Sub
[/code][/quote]

Thank you - this community is very helpful. :slight_smile:

I’m scared to even start trying to update my code to suit API2

I finished mine some time ago. Then again, I’ve got the time to do it. From about 5000, now just two deprecation warnings left that will go when 2020r1 arrives.

I’ve also gotten rid of Text, and all usage of Xojo.XXX. With the new DateTime class, out went my own DateTime subclass of Date to which I’d added SecondsSince1970.

Yesterday I finally paid attention to the ability of Database.ExecuteSQL and .SelectSQL to accept parameters for Prepare, so out went three of my own methods which did more or less the same.

I also rethought my socket handling and ended up writing my own method to validate UTF8 which was what allowed me to complete the removal of Text from my app. I think one has to do that sometimes - see <https://xojo.com/issue/44953> for another example.

Make sure you have a back up and lots of time. The backup is good in case you make a change then forget what the code used to look like. Time is needed because I had 20,000+ deprecations, now down to nought for desktop apps. I have gone from 10,000 errors (forced deprecations) to 3,500 in my main Web 2.0 app. It has taken me a few weeks to convert both Desktop and Web.
The result is my code is now MUCH cleaner and smaller, and works across Desktop and Web with little difference. I spend a lot of time removing duplicate Desktop/Web code these days.
My muscle memory is harder to train since I still have some old API 1.0 code I need to maintain for a client. I will have to straddle the API 1.0/2.0 universes for a while.

My bottom line is that I’m feeling rather positive about API 2.