Question Rnd vb to gambas

View: New views
4 Messages — Rating Filter:   Alert me  

Question Rnd vb to gambas

by Dmxa () :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a doubt, not long ago I started with the gambas2 and I am proving of passing 1 program Rnd of VB08 to gambas2 but when doing the function Rnd from a listbox to a textbox I do not obtain to leave.
in VB08 use:
Dim i2 As Integer
i2 = Int(Rnd() * (lbDatos2.Items.Count - 1))
lis.lisx.Text = lis.lisx.Text & lbDatos2.Items.Item(i2) & vbCrLf & vbCrLf

exampe: list items : a, b, c and d. -> use this command and select randon 1 item of list and print en textbox -> b
but, i have read manual but follow tied up, using the:
DIM y AS Integer
        y = Int(Rnd() * (ListBox2.List.Count - 1))
        TextArea1.Text = TextArea1.Text & ListBox2.List.Join(y) & "\n"

following numbers go out me the contents of the the ready: list items: a, b, c and d, use the command -> a2b2c2d
I have varied formulates her but the same always comes out:
 ListBox2.List.Join((y), "-") ---> -a-3-b-3-c-3-d-
does anybody know as it can be made?

PD: the equivalent link label in gambas who are?

Re: Question Rnd vb to gambas

by Jussi Lahtinen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What is the wanted output?
Perhaps you mean;
TextArea1.Text &= ListBox2[y].Text & "\n"

Jussi


On Thu, Nov 5, 2009 at 02:09, Dmxa <dmxa69@...> wrote:

>
> I have a doubt, not long ago I started with the gambas2 and I am proving of
> passing 1 program Rnd of VB08 to gambas2 but when doing the function Rnd
> from a listbox to a textbox I do not obtain to leave.
> in VB08 use:
> Dim i2 As Integer
> i2 = Int(Rnd() * (lbDatos2.Items.Count - 1))
> lis.lisx.Text = lis.lisx.Text & lbDatos2.Items.Item(i2) & vbCrLf & vbCrLf
> exampe: list items : a, b, c and d. -> use this command and select randon 1
> item of list and print en textbox -> b
> but, i have read manual but follow tied up, using the:
> DIM y AS Integer
>        y = Int(Rnd() * (ListBox2.List.Count - 1))
>        TextArea1.Text = TextArea1.Text & ListBox2.List.Join(y) & "\n"
> following numbers go out me the contents of the the ready: list items: a, b,
> c and d, use the command -> a2b2c2d
> I have varied formulates her but the same always comes out:
>  ListBox2.List.Join((y), "-") ---> -a-3-b-3-c-3-d-
> does anybody know as it can be made?
>
> PD: the equivalent link label in gambas who are?
> --
> View this message in context: http://old.nabble.com/Question-Rnd-vb-to-gambas-tp26160471p26160471.html
> Sent from the gambas-user mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@...
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Question Rnd vb to gambas

by Fabien Bodard-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dim i2 As Integer
i2 = Int(Rnd() * (lbDatos2.Items.Count - 1))
lis.lisx.Text = lis.lisx.Text & lbDatos2.Items.Item(i2) & vbCrLf & vbCrLf




gambas



Dim i2 as integer

i2 = int(Rnd()*(lbDatos2.Count-1)

txtB.Text &= lbDatos2[i2] & "\n\n"


that's all :)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Question Rnd vb to gambas

by Dmxa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thx all for help XD

Dmxa wrote:
I have a doubt, not long ago I started with the gambas2 and I am proving of passing 1 program Rnd of VB08 to gambas2 but when doing the function Rnd from a listbox to a textbox I do not obtain to leave.
in VB08 use:
Dim i2 As Integer
i2 = Int(Rnd() * (lbDatos2.Items.Count - 1))
lis.lisx.Text = lis.lisx.Text & lbDatos2.Items.Item(i2) & vbCrLf & vbCrLf

exampe: list items : a, b, c and d. -> use this command and select randon 1 item of list and print en textbox -> b
but, i have read manual but follow tied up, using the:
DIM y AS Integer
        y = Int(Rnd() * (ListBox2.List.Count - 1))
        TextArea1.Text = TextArea1.Text & ListBox2.List.Join(y) & "\n"

following numbers go out me the contents of the the ready: list items: a, b, c and d, use the command -> a2b2c2d
I have varied formulates her but the same always comes out:
 ListBox2.List.Join((y), "-") ---> -a-3-b-3-c-3-d-
does anybody know as it can be made?

PD: the equivalent link label in gambas who are?