Hello. My name is Brian. I am fairly new to xojo. I have a situation in which I am trying to produce a very specialized Algorithm Generator that is targeted at Rawhide, and Leather Braiders. I have images of what I’m trying to do and 1 image where I’m only half way completed.
Okay. So i’ve been trying this and not getting my results txtTotal or txtRemainder. I need help with this code and what i’m doing wrong.
Code;
[code] Dim txtPartsField As String
Dim txtBightsField As String
Dim txtTotal As String
Dim txtRemainder As String
Dim txtWraps As String
Dim txtGCD As String
Dim txtHalfCycles As String
’ Math
txtTotal = Str(Val(txtPartsField) / Val(txtBightsField))
txtRemainder = Str(Val(txtPartsField) Mod Val(txtBightsField))[/code]
Ok, I’m going to assume that these are also textfield controls on your window? Add .text to txtTotal & txtRemainder before the =. Unlike VB you can’t set the value of a textfield control without specifying the property - you do need to specify the text property of the class (at first I saw this as a bit of a pain, but have come to realize that strong typing should be consistent).
The text boxes to the far left are for user input. the orange colored ones are for the results.
The coding for it so far.
[code] Dim txtPartsField As String
Dim txtBightsField As String
Dim txtTotal As String
Dim txtRemainder As String
Dim txtWraps As String
Dim txtGCD As String
Dim txtHalfCycles As String
’ Math
txtTotal = Str(Val(txtPartsField) / Val(txtBightsField))
txtRemainder = Str(Val(txtPartsField) Mod Val(txtBightsField))[/code]
Do what Wayne said. You need to use the names of the fields in your window, and if they’re text fields, then .text will get you the contents of those fields as strings. Eliminate these two dim statements if the fields in your window are named txtPartsField and txtBightsField:
Dim txtPartsField As String
Dim txtBightsField As String
Personally, I like to use Self. when referring to controls that are in the same window as the code that calls them.
For example: I use Self.txtPartsField.text, which means that “txtPartsField” is a control on the same window this code is in, and “.text” gets you the content of that control as a string.
Got working so far. But need help with 2 result boxes and the format.
The total comes up with a decimal like 3.25. All I need is just the whole number of 3. Plus how do I use GCD, or how to code 2 results to get the GCD result.