saramgsilva Posted January 23, 2007 at 07:16 PM Report #78117 Posted January 23, 2007 at 07:16 PM olá pessoal eu estou a fazer um programa, e estou com alguma dúvidas: Private Sub Command1_click() Dim linhas As Integer Dim colunas As Integer Dim i As Integer Dim j As Integer Dim contador As Integer linhas = Val(TextBox1.Text) colunas = Val(TextBox2.Text) If linhas = 0 Or colunas = 0 Then MsgBox("Erro....") Else picture1.Cls() contador = 0 For i = 1 To linhas For j = 1 To colunas contador = contador + 1 picture1.print contador Next Next End If End Sub o meu problema é: se linhas = 2 e colunas =4 deveria ter o resultado na Picture1 assim : 1 2 3 4 5 6 7 8 e está aparecer : 1 2 3 4 5 6 7 8 www.saramgsilva.com As minhas apps no WP7 Marketplace Youtube : Galinho - Windows Phone 7.5
Revolt Posted January 23, 2007 at 10:19 PM Report #78181 Posted January 23, 2007 at 10:19 PM Private Sub Command1_click() Dim linhas As Integer Dim colunas As Integer Dim lista() as Integer Dim i As Integer Dim j As Integer Dim contador As Integer linhas = Val(TextBox1.Text) colunas = Val(TextBox2.Text) If linhas = 0 Or colunas = 0 Then MsgBox("Erro....") Else picture1.Cls() contador = 0 For i = 1 To linhas For j = 1 To colunas Redim Preserve lista(contador) contador = contador + 1 lista(contador) = contador Next Next Dim lista2() as Integer Dim o as Integer = 0 For i = 1 to contador If o = 4 Then Picture1.print lista2(0) & " " & lista2(1) & " " & lista2(2) & " " & lista2(3) picture1.print ControlChars.Crlf o = 0 Else lista2(o) = lista(i) o += 1 Next End If End Sub Talvez uma coisa deste género ou parecida? EDIT: Não sei se existe a classe ControlChars em VB6 mas deve existir algo parecido 😉 Revolt Website Antigo Nick: Pauzinhos
NuGuN Posted January 24, 2007 at 09:32 PM Report #78364 Posted January 24, 2007 at 09:32 PM Boas... Outra soloção seria esta: Private Sub Command1_click() Dim linhas As Integer Dim colunas As Integer Dim i As Integer Dim j As Integer Dim contador As Integer Dim temp As String linhas = Val(TextBox1.Text) colunas = Val(TextBox2.Text) If linhas = 0 Or colunas = 0 Then MsgBox ("Erro....") Else Picture1.Cls contador = 0 For i = 1 To linhas temp = vbNullString ' ou temp = "" For j = 1 To colunas contador = contador + 1 temp = temp & " " & contador Next Picture1.Print temp Next End If End Sub Desculpa lá o código estar em VB6... ? Cumps
saramgsilva Posted January 25, 2007 at 02:27 PM Author Report #78506 Posted January 25, 2007 at 02:27 PM Boas... Outra soloção seria esta: Private Sub Command1_click() Dim linhas As Integer Dim colunas As Integer Dim i As Integer Dim j As Integer Dim contador As Integer Dim temp As String linhas = Val(TextBox1.Text) colunas = Val(TextBox2.Text) If linhas = 0 Or colunas = 0 Then MsgBox ("Erro....") Else Picture1.Cls contador = 0 For i = 1 To linhas temp = vbNullString ' ou temp = "" For j = 1 To colunas contador = contador + 1 temp = temp & " " & contador Next Picture1.Print temp Next End If End Sub Desculpa lá o código estar em VB6... ? Cumps ya fixe!!! acho que é mm isso que quero< 😉 vou testar ... obrigada tofas www.saramgsilva.com As minhas apps no WP7 Marketplace Youtube : Galinho - Windows Phone 7.5
saramgsilva Posted January 25, 2007 at 04:33 PM Author Report #78535 Posted January 25, 2007 at 04:33 PM já consegui 😉 ehehhe obrigada pela ajuda!!!! Codigo final: Private Sub Command1_click() Dim linhas As Integer Dim colunas As Integer Dim i As Integer Dim j As Integer Dim contador As Integer Dim temp As String linhas = Val(Text1.Text) colunas = Val(Text2.Text) If linhas = 0 Or colunas = 0 Then MsgBox ("Erro....") Else Picture1.Cls contador = 0 For i = 1 To linhas temp = "" ' ou temp = vbNullString For j = 1 To colunas contador = contador + 1 temp = temp & " " & contador Next Picture1.Print temp Next End If End Sub www.saramgsilva.com As minhas apps no WP7 Marketplace Youtube : Galinho - Windows Phone 7.5
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now