Inquiridor
Problema visual basic .NET

Pergunta
-
bom dia senhores estou com mais uma duvida espero que alguem possa me ajudar
estou fazendo um uma sequencia de numeros aleatorios ate ao cinquenta sem repetições e consegui o problema e que to tentando gerar em ordem exemplo do menor para o maior , e queria colocar em linhas ate 20 numero por cada linha , se alguem puder me ajudar agradeço desde jah
aparece assim : 50 35 20 17 45 1 7 19 36 42 4 49 24 12 9 40 3 10 8 6
quero que mostre asim: 01 03 04 06 07 08 09 10 12 17 19 20 24 35 36 40 42 45 49 50 enter
Ate mil registros
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim X As Integer
Randomize()
For X = 0 To 1000
TextBox1.AppendText(Str(Int(Rnd() * 50)))
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Close()
End Sub
End Class
Todas as Respostas
-
-
sim tentei o código fica cero mais retorna a mesma coisa, olhe abaixo o código e a tela
o que eu faço? :\
Public Class Form1
Private _ascW As Integer
Dim TextBox As Char
Private Property AscW(ByVal tabInfo As TabInfo) As Integer
Get
Return _ascW
End Get
Set(ByVal value As Integer)
_ascW = value
End Set
End Property
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim X As Integer
Randomize()
For X = 0 To 1000
If X > 20 And X < 50 Then
End If
TextBox1.AppendText(Str(Int(Rnd() * 50)))
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Close()
End Sub
End Class
-
vc tem que jogar o randomize em algumm lugar e depois dar um for percorrendo esse lugar e ai sim vc faz o teste e imprime o que vc quer. direto no randomize como vc fez não dá certo mesmo, faça como vc fez antes jogue o randomize para o textbox ai vc percorre o textbox com um for
for x= 0 to textbox.length - 1
ai aqui dentro vc faz os if
Junior
-
ficaria assim o código? sou iniciante se puder me ajudar júnior:
Public Class Form1
Private Property troca As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim X As Integer
Randomize(X)
For X = 0 To 1000
Next
For X = 0 To TextBox1.Text - 1
If X > 0 And X < 1000 Then
End If
Next
TextBox1.AppendText(Str(Int(Rnd(50) * 50)))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Close()
End Sub
End Class
-
Pablo, olha se isso te ajuda.
Agora que você tem seus valores salvos em matNum, pode chamar algum procedimento que ordene estes números.Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim X, y As Integer Dim matNum(50, 20) As Integer For X = 0 To 49 For y = 0 To 19 matNum(X, y) = Rnd() * 50 TextBox1.AppendText(Str(matNum(X, y))) Next TextBox1.AppendText(vbCrLf) Next
End Sub
-
não ainda não me ajudou os códigos que vc me passou estão dando erro
eu to conseguindo gerar os códigos mais nao estou conseguindo gerar de forma organizada
eu quero na verdade e fazer um bingo com 25 dezenas com os números de 1 a 90
so que estou usando o listbox só que a mer@#$@ do trem não declara no componente que estou tentando usar detalhe no textbox gera os codigos mais nao organiza nem a pau
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.clear()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As Integer
Dim maior = 25
Dim menor = 1
Dim repetido As Boolean
Randomize()
For x = 1 To 25
repetido = False
Randomize()
Next
For x = 1 To 25
((Str(Int(Rnd() * 90))))
If x < 1 Then
End If
If x > 25 Then
End If
Next
End Sub