This method cannot accept an assigned value (it lacks an Assigns parameter)

I wrote a program in RealBasic, back in 2012. I was planning to convert it over to Visual Studio but after re-familiarising myself with Xojo and RB (using an old archived version from 2011) I remembered that it’s easier to use in many ways.

So instead, I decided to try the simplest of additions and came up with the above bug, which occurs in both the 2011 RB and the latest Xojo. It’s a very basic addition, I simply added a control (tried various controls) and then tried to assign a value to the control. The control is recognised by the editor and is picked up by the intellisense, so it knows it’s there but seems confused by it. I tried resetting my PC etc, but it occurs in both RB and Xojo.

The control is inside a ControlContainer, which is added to the main window. I’d done this several times in the existing program and have used the same syntax etc, which all worked fine. But not with my new addition which is identical.

So my ControlContainer is named ‘ccGround’ and when added to my main form becomes ‘ccGround1’. I add a label, which just becomes label9, so to access it, I use ccGround1.label9 = “”. As I said, intellisense picks that up. But when I run the program, I get the error in the headline. That’s in Xojo.

In the old 2011 RB it just says ‘This method or property does not exist’.

It’s really really basic stuff, so I can only assume I’m doing something fundamentally wrong or I’ve missed something very obvious.

You cannot assign a value of “” to a label. A label is an object. But you can assign a value of “” to a label’s text property.

ccground1.label9.text = ""

The error messages differ between RB/RS and Xojo because they use different compilers.

1 Like

You can’t just use the control name, you have to assign one of its properties, like

ccGround1.label9.Text = “”

Oh boy, I really have been away from programming for too long. Thanks guys, it was that obvious. Looking at my ‘identical’ lines that WERE working, obviously they had .text… ugh.

This is what 10 years away does to the brain :blush: