I tried to write my first app in Xojo but I can’t. Please help what I mistake.
Dim TextField1 As String
Dim val As Integer
Dim sum As Integer
val = 5
sum = CDbl(TextField1) + val
I run it, write a number to the text field.
The result is “5” and in debug mode the “TextField1” is empty (does not contain any value)
You need to use the property of text field, to get at its value.
I tried it but I got error:
Window1.PushButton1.Action, line 7: Type “String” has no member named “text”.
TextField is not a String, it is a TextField.
But TextField has a property called text which is a string
Dim s as String
s = TextField
Is wrong, but
Dim s as String
s = TextField.text
Next you need to understand the difference between text and numbers.
1 is a number
“1” is a string
A 1 typed in a TextField is a string, NOT a number.
Addition for numbers:
1 + 1 = 2
Addition for strings:
“A” + “B” = “AB”
“1” + “1” = “11”
1 + Textfield1.text
Is utter nonsense (what is this? Addition for numbers? Or for Strings?) and you’ll get an error.
To add the NUMERICAL value for the STRING in the TextField you’ll need to convert it into a NUMERICAL VALUE with
1 + Val(Textfield1.text). // now it is clearly an Addition for numbers
But you really should read the introduction first. That’s what it is for.
You don’t dim a textfield. You drag it onto the layout editor.
Looks like it would help you greatly to read Introduction to Programming
I read the introduction but I have to read it again
If your very new, perhaps youtube can help you get where you want to be.
Yes, I am very new.
I’m starting to develope for my company a not too difficult app.
I use osx, my colleagues use windows.
I don’t want to use virtualization for developing and the Xojo is the most likeable software for this project (however I would like to use my app on osx and tablets later).
I hope Xojo is the best choice