[Gambas-user] (no subject)

Charlie Reinl Karl.Reinl at ...9...
Wed Apr 1 21:56:03 CEST 2009


Am Mittwoch, den 01.04.2009, 20:52 +0300 schrieb vlahonick vlahonick:
> 
> 
> > From: Karl.Reinl at ...9...
> > To: gambas-user at lists.sourceforge.net
> > Date: Wed, 1 Apr 2009 18:14:32 +0200
> > Subject: Re: [Gambas-user] (no subject)
> > 
> > Am Mittwoch, den 01.04.2009, 18:55 +0300 schrieb vlahonick vlahonick:
> > > 
> > > 
> > > > From: Karl.Reinl at ...9...
> > > > To: gambas-user at lists.sourceforge.net
> > > > Date: Wed, 1 Apr 2009 17:16:38 +0200
> > > > Subject: Re: [Gambas-user] (no subject)
> > > > 
> > > > Am Mittwoch, den 01.04.2009, 17:06 +0300 schrieb vlahonick vlahonick:
> > > > > Thanks you all for your replies....
> > > > > For those that they propuse me to put "end if" at the end of the code of course i did that!!!!
> > > > > In the screenshot i send you all it was just a part of the code,the theme of the screenshot was to show u the error.
> > > > > If i didnt close the code with as many end if were needed the language itself would give me other error that end if are needed.
> > > > > The code i wrote was completely correct,i double-triple checked it...
> > > > > In the screenshot i repeat is just a very small part of my code because i want u to see the error and not the code...
> > > > > Anyway i tried to rewrite my code with the Select Case expression but is more difficult because there are many cases and ONLY
> > > > > one have to be triggered per time and which case should be triggered depends from what the user will wirte...
> > > > > I didnt really succeded to do that with the Select Case expression.
> > > > > So here i give u an example and if someone could help me by writing the same example with the select case expression it will be very helpful.
> > > > > 
> > > > > PUBLIC SUB Button1_Click
> > > > > 
> > > > > if textbox1.text = "a" then
> > > > > textbox2.text = "b"
> > > > > else
> > > > > if textbox1.text = "b" then
> > > > > textbox2.text = "g"
> > > > > end if
> > > > > end if
> > > > > 
> > > > > END
> > > > > 
> > > > > (like the example is my program's code-and the events are triggered when the user press the OK button)
> > > > > 
> > > > > ty in advance again...:D
> > > > 
> > > > Salut,
> > > > 
> > > > first: tell us what version of Gambas you are using.
> > > > second: am I right, you are writing a kind of CONVERTER ?
> > > > 	
> > > > if so this is what I would write quickly.
> > > > 
> > > > FUNCTION myConvert(sInChar AS String) AS String
> > > > DIM sRetChar AS String = sInChar  ' makes the return value to the given
> > > > value
> > > >    ' now make you changes
> > > >   IF sInChar = "a" THEN sRetChar = "0"
> > > >   IF sInChar = "b" THEN sRetChar = "1"
> > > >   IF sInChar = "c" THEN sRetChar = "2"
> > > >   IF sInChar = "d" THEN sRetChar = "3"
> > > >   IF sInChar = "e" THEN sRetChar = "4"
> > > >   IF sInChar = "f" THEN sRetChar = "5"
> > > >   IF sInChar = "g" THEN sRetChar = "6"
> > > >   IF sInChar = "h" THEN sRetChar = "7"
> > > >   IF sInChar = "i" THEN sRetChar = "8"
> > > >   IF sInChar = "j" THEN sRetChar = "9"
> > > >   IF sInChar = "0" THEN sRetChar = "a"
> > > >   IF sInChar = "1" THEN sRetChar = "b"
> > > >   IF sInChar = "2" THEN sRetChar = "c"
> > > >   IF sInChar = "3" THEN sRetChar = "d"
> > > >   IF sInChar = "4" THEN sRetChar = "e"
> > > >   IF sInChar = "5" THEN sRetChar = "f"
> > > >   IF sInChar = "6" THEN sRetChar = "g"
> > > >   IF sInChar = "7" THEN sRetChar = "h"
> > > >   IF sInChar = "8" THEN sRetChar = "i"
> > > >   IF sInChar = "9" THEN sRetChar = "j"
> > > >   RETURN sRetChar
> > > > END
> > > > 
> > > > I attached you a test.
> > > > 
> > > > -- 
> > > > Amicalment
> > > > Charlie
> > > 
> > > 
> > > I tried your test and it was really what i need :D
> > > Faster in code with less writing and more simple :D
> > > But when i try to modify it and put instead of number greek latters and then i run the program
> > > the result in text box 2 is some boxes like |X|...so this means that for some reason the program doesnt respawn in greek or doesnt understand them?
> > > How i can modify the code?
> > > 
> > > ty a lot
> > 
> > Salut,
> > 
> > seams to be a UTF problem.
> > 
> > make a NEW project, with one form, 2 NEW textboxs and a NEW button, then
> > copy all the code from the .class from the Test-project to your
> > new .class
> > 
> > May be that helps.
> > 
> > PS: I call that an converter.
> > -- 
> > Amicalment
> > Charlie
> > 
> ty one more time for ur replies but still got problems...
> i tried to follow ur instructions but failed again by the result...
> i prefer the whole thing to be triggered when u press the ok button so i didnt put the code in the textbox1.text but at the button (doesnt mmater just told u)
> here is the code i wrote quickly...to try it..
> 
> 
> PUBLIC SUB Button1_Click()
> DIM nI AS Integer
> DIM sAnyChar AS String
> TextBox2.text = ""
>    FOR nI = 1 TO Len(TextBox1.Text)
>       sAnyChar = Mid(TextBox1.Text, nI, 1)
>       TextBox2.Text = TextBox2.Text & Gronverter(sAnyChar)
>    NEXT 
> END
> 
> FUNCTION Gronverter(sInChar AS String) AS String
> DIM sRetChar AS String = sInChar
> 
> IF sInChar = "α" THEN sRetChar = "a"
> IF sInChar = "β" THEN sRetChar = "v"
> IF sInChar = "γ" THEN sRetChar = "g"
> IF sInChar = "δ" THEN sRetChar = "d"
> IF sInChar = "ε" THEN sRetChar = "e"
> IF sInChar = "ζ" THEN sRetChar = "z"
> IF sInChar = "η" THEN sRetChar = "ι"
> IF sInChar = "θ" THEN sRetChar = "th"
> IF sInChar = "ι" THEN sRetChar = "i"
> IF sInChar = "κ" THEN sRetChar = "k"
> IF sInChar = "λ" THEN sRetChar = "l"
> IF sInChar = "μ" THEN sRetChar = "m"
> IF sInChar = "ν" THEN sRetChar = "n"
> IF sInChar = "ξ" THEN sRetChar = "x"
> IF sInChar = "ο" THEN sRetChar = "o"
> IF sInChar = "π" THEN sRetChar = "p"
> IF sInChar = "ρ" THEN sRetChar = "r"
> IF sInChar = "σ" THEN sRetChar = "s"
> IF sInChar = "τ" THEN sRetChar = "t"
> IF sInChar = "υ" THEN sRetChar = "i"
> IF sInChar = "φ" THEN sRetChar = "f"
> IF sInChar = "χ" THEN sRetChar = "h"
> IF sInChar = "ψ" THEN sRetChar = "ps"
> IF sInChar = "ω" THEN sRetChar = "o"
> RETURN sRetChar
> 
> END
> 
> PUBLIC SUB Button2_Click()
> 
>   TextBox1.text = ""
>   TextBox2.text = ""
> END
> 
> i dont know what is my mistake but now when i press ok in the textbox2.text apperas exactrly what i wrote in the textbox1.text and not what i want...
> p.s. yes now i realize that is a converter...:D
> 
> plz help me to find out what i had wrong in the code:( 
> 
> ty all in advance :D
> 
> vlahonick :D (all the time i forgot to write my name)

Salut,

try this, this way only one lettre is in the TextBox1.Text

PUBLIC SUB TextBox1_Change()
   IF TextBox1.Text <> "" THEN
	   TextBox2.Text = ""
	   TextBox2.Text = myConvert(TextBox1.Text)
	   TextBox1.Text = ""
   END IF 
END

-- 
Amicalment
Charlie





More information about the User mailing list