Level 1, Lesson 5 practice 2


#1

When using “Get Text” to read the font size in notepad, I get this error when setting the output variable to type Int32

Compiler error(s) encountered processing expression “fontSize”. Invalid L-value expression. Reference expressions cannot end with Conversion. The provided expression’s type must exactly match the type T of VisualBasicReference or LambdaReference

Looking at the answers file, the variable type is set to Int32, but there are no compiler errors.

It does need to be set to Int32, for the expression (fontSize + 5).toString to work, right?


#3

Hi wuigukin,

I’m pretty sure you created the variable as a GenericValue before change its type to Int32.
Try this: for the output variable of your Get Text Activity, type a and Save the project (CTRL+s)
Now type fontSize again and save. Your error should be gone.


#4

Thanks for the reply! You’re right that I first created the variable with the generic value. This was a result of right clicking the output field and selecting create variable. I didn’t try your method, but did find a way that worked. Instead of creating the variable by using the output field, I created it manually in the variable tab and set the type to Int32. This seemed to work just fine :slight_smile: