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
TEST-0.0.1.tar.gz
Description: application/compressed-tar
------------------------------------------------------------------------------
_______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user