I can not find the gambas farm
I am looking for code to convert a number to text for a check writing program
I have found excell macros and vb code ... there must be gambas code to do it also
Not the farm problem but mine Solved
- grayghost4
- Posts: 187
- Joined: Wednesday 5th December 2018 5:00am
- Location: Marengo, Illinois usa
Not the farm problem but mine Solved
Last edited by grayghost4 on Friday 11th June 2021 6:07pm, edited 1 time in total.
- cogier
- Site Admin
- Posts: 1129
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: the farm is still down ??
There was an issue with Gambas.One accessing the Gambas Farm, so we are not doing it any more. You can access the Farm from Gambas: -
- grayghost4
- Posts: 187
- Joined: Wednesday 5th December 2018 5:00am
- Location: Marengo, Illinois usa
Re: the farm is still down ??
must be a dunce but I can't find the page you showed:
http://gambas.sourceforge.net
does not get me there ?
http://gambas.sourceforge.net
does not get me there ?
- cogier
- Site Admin
- Posts: 1129
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: the farm is still down ??
The page shown is what you see when you first open Gambas.
- grayghost4
- Posts: 187
- Joined: Wednesday 5th December 2018 5:00am
- Location: Marengo, Illinois usa
Re: the farm is still down ??
Like I said I am a DUNCE , I have been looking on line for a week for it
but there does not seem to be anything there that will help with my problem
but there does not seem to be anything there that will help with my problem
- BruceSteers
- Posts: 1606
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: the farm is still down ??
Theres also a menu item in the gambas ide takes you to farm
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- BruceSteers
- Posts: 1606
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: the farm is still down ??
If there is no solution available, make one
Or post the problem here...
Or post the problem here...
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- cogier
- Site Admin
- Posts: 1129
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: the farm is still down ??
Run this code in a 'Graphical application'. It will display text up to 999.99. Hopefully it will get you started.I am looking for code to convert a number to text for a check writing program
' Gambas class file
$Int As String
$Frac As String
HBox1 As HBox
HBox2 As HBox
Panel1 As Panel
ValueBoxInput As ValueBox
TextBoxAnswer As TextBox
Public Sub Form_Open()
If System.Language = "en_GB.UTF-8" Then
$Int = " pounds"
$Frac = " pence"
Endif
If System.Language = "en_US.UTF-8" Then
$Int = " dollars"
$Frac = " cents"
Endif
Me.Center
BuildForm
ValueBoxInput.SetFocus
End Sub
Public Sub ValueBoxInput_Change()
Dim iInt As Integer = Fix(ValueBoxInput.Value)
Dim iFrac As Integer = Int(Frac(ValueBoxInput.Value) * 100)
Dim sText As String
SText = GetText(iInt) ' Get the Pounds (Dollars)
TextBoxAnswer.Text = UCase(sText[0]) & Mid(sText, 2) & $Int
sText = GetText(iFrac) ' Get the Pence (Cents)
If Trim(sText) <> "" Then TextBoxAnswer.Text &= " and " & sText & $Frac
If ValueBoxInput.Value = 0 Then TextBoxAnswer.Clear
End
Public Sub GetText(iValue As Integer) As String
Dim sNumbers As String[][] = [["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"], ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eightteen", "nineteen"], ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]]
Dim sValue As String = Str(iValue)
Dim iLen As Integer = Len(sValue)
If iLen = 1 Then Return sNumbers[0][Val(sValue)]
If iLen = 2 And iValue < 20 Then Return sNumbers[1][Val(sValue[1])]
If iLen = 2 And iValue > 19 Then Return sNumbers[2][Val(sValue[0])] & " " & sNumbers[0][Val(sValue[1])]
If iLen = 3 And Val(Mid(sValue, 2)) < 10 Then Return sNumbers[0][Val(sValue[0])] & " hundred and " & sNumbers[0][Val(sValue[2])]
If iLen = 3 And Val(Mid(sValue, 2)) > 9 And Val(Mid(sValue, 2)) < 20 Then Return sNumbers[0][Val(sValue[0])] & " hundred and " & sNumbers[1][Val(sValue[2])]
If iLen = 3 And Val(Mid(sValue, 2)) > 19 Then Return sNumbers[0][Val(sValue[0])] & " hundred and " & sNumbers[2][Val(sValue[1])] & " " & sNumbers[0][Val(sValue[2])]
End
Public Sub BuildForm()
With Me
.Height = 100
.Width = 500
.Padding = 5
.Arrangement = Arrange.Vertical
.Center
End With
With HBox1 = New HBox(Me)
.H = 28
.W = 100
End With
With ValueBoxInput = New ValueBox(HBox1) As "ValueBoxInput"
.H = 28
.W = 160
.Type = ValueBox.Currency
End With
With Panel1 = New Panel(Me)
.H = 28
.W = 100
End With
With HBox2 = New HBox(Me)
.H = 28
.W = 100
End With
With TextBoxAnswer = New TextBox(HBox2) As "TextBoxAnswer"
.H = 28
.W = 100
.Expand = True
End With
End
- grayghost4
- Posts: 187
- Joined: Wednesday 5th December 2018 5:00am
- Location: Marengo, Illinois usa
Re: the farm is still down ??
thank you I was Halfway there ... but you have improved it greatly ... that is exactly what I was looking forRun this code in a 'Graphical application'. It will display text up to 999.99. Hopefully it will get you started.
thanks again
Marv
- grayghost4
- Posts: 187
- Joined: Wednesday 5th December 2018 5:00am
- Location: Marengo, Illinois usa
Re: Not the farm problem but mine Solved
I went at the project a little differently than you did I wanted a max of 99999.99 all in one function..
I world be intrested in any comments or improvements
Thanks for the help.
Marv
I world be intrested in any comments or improvements
Thanks for the help.
Marv
Public Sub GetText(iValue As Float) As String
Dim sNumbers As String[][] = [["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"], ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eightteen", "nineteen"], ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]]
Dim sValue As String = Str(Fix(iValue))
Dim icents As Integer = Int(Frac(iValue) * 100)
Dim iLen As Integer = Len(sValue)
Dim sResult As String
Dim $ones As Integer = 0
Dim $teens As Integer = 1
Dim $over19 As Integer = 2
If iLen = 5 Then
If Val(Mid(sValue, 1, 2)) < 20 Then sResult = sNumbers[$teens][Val(Mid(sValue, 2, 1))]
If Val(Mid(sValue, 1, 2)) > 19 Then sResult = sNumbers[$over19][Val(Mid(sValue, 1, 1))] & " " & sNumbers[$ones][Val(Mid(sValue, 2, 1))]
sResult &= " thousand "
svalue = Right(svalue, 3)
iLen = 3
Endif
If iLen = 4 Then
sResult &= sNumbers[$ones][Val(Left(sValue, 1))] & " thousand "
svalue = Right(svalue, 3)
iLen = 3
Endif
If iLen = 3 And Val(Left(sValue, 1)) Then
sResult &= sNumbers[$ones][Val(Left(sValue, 1))] & " hundred "
svalue = Right(svalue, 2)
iLen = 2
Endif
If iLen = 2 Then
If Val(Right(sValue, 2)) < 20 Then sResult &= sNumbers[$teens][Val(Mid(sValue, 2, 1))]
If Val(Right(svalue, 2)) > 19 Then sResult &= sNumbers[$over19][Val(Mid(sValue, 1, 1))] & " " & sNumbers[$ones][Val(Mid(sValue, 2, 1))]
Endif
If iLen = 1 Then sResult &= sNumbers[$ones][Val(sValue)]
Return = "* * * " & UCase(sResult[0]) & Mid(sResult, 2) & " dollars and " & icents & " cents" & " * * *"
End