Jump to content

Como por numeros por ordem separados por (-)


programadorvb6

Recommended Posts

Olá boa tarde , fiz um pequeno programa em que tenho de separar os números pelo carácter (-) na minha ListBox ao sortear gostaria que fica-se assim : ex 1 - 12 - 14 - 20 - 32. Junto anexo o código.

Desde já agradeço a vossa atenção.

Imports System.Collections.Generic
Imports System.Linq
Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click



        Dim quantosNumerosNalista As Integer = 20
        Dim de As Integer = 1
        Dim ate As Integer = 101
        Dim result = Enumerable.Range(de, ate).OrderBy(Function(g) Guid.NewGuid()).Take(quantosNumerosNalista).OrderBy(Function(o) o).ToList()

        For Each num As Integer In result

            Listagem.Items.Add(num)
        Next
    End Sub
End Class

______________________________________________________________________________

Que minha coragem seja maior que meu medo e que minha força seja tão grande quanto minha fé.
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.