Prikazi cijelu temu 26.02.2020 11:26
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Lokacija:Tuzla


Predmet:Re: svaki treći red iz datagrid-a
PreuzmiIzvorni kôd (Visual Basic):
  1. For Each red As DataGridViewRow In DataGridView1.Rows
  2. Dim rednibroj As Integer = DataGridView2.Rows.Count - 1
  3.  
  4. If broj = 1 Then
  5.  
  6. Dim length As Integer = Trim(red.Cells(1).Value.Replace(" ", "")).Length
  7. If length > 3 Then
  8. DataGridView2.Rows.Add(Trim(red.Cells(1).Value).Replace(" ", ""))
  9.  
  10. broj = 2
  11.  
  12. ElseIf length > 1 And length < 4 Then
  13.  
  14. broj_dana_blokade = Trim(DataGridView1.Rows(DataGridView1.Rows.Count - 1).Cells(1).Value.Replace(" ", ""))
  15.  
  16. TextBox1.Text = broj_dana_blokade.ToString
  17. End If
  18.  
  19. ElseIf broj = 2 Then
  20.  
  21. DataGridView2.Rows(rednibroj).Cells(1).Value = Trim(DataGridView1.Rows(rednibroj * 3 + 1).Cells(1).Value.Replace(" ", ""))
  22.  
  23. broj = 3
  24.  
  25. ElseIf broj = 3 Then
  26. DataGridView2.Rows(rednibroj).Cells(2).Value = Trim(DataGridView1.Rows(rednibroj * 3 + 2).Cells(1).Value.Replace(" ", ""))
  27.  
  28. broj = 1
  29. End If
  30.  
  31. Next

Jeli to ova petlja?
Ne vidim ovdje kako povecavas variablu koja se zove broj.
Sa ovim broj bi mogao rijesiti da citas svaki treci ali ga moras povecavati za 3.
Prco reci jel ovo ta petlja i sto ce ti ovi if za broj.
Podrška samo putem foruma, jer samo tako i ostali imaju koristi od toga.