Predmet:Re: svaki treći red iz datagrid-a
   
PreuzmiIzvorni kôd (Visual Basic):For Each red As DataGridViewRow In DataGridView1.Rows
 
Dim rednibroj As Integer = DataGridView2.Rows.Count - 1
 
 
 
If broj = 1 Then
 
 
 
Dim length As Integer = Trim(red.Cells(1).Value.Replace(" ", "")).Length
 
If length > 3 Then
 
DataGridView2.Rows.Add(Trim(red.Cells(1).Value).Replace(" ", ""))
 
 
 
broj = 2
 
 
 
ElseIf length > 1 And length < 4 Then
 
 
 
broj_dana_blokade = Trim(DataGridView1.Rows(DataGridView1.Rows.Count - 1).Cells(1).Value.Replace(" ", ""))
 
 
 
TextBox1.Text = broj_dana_blokade.ToString
 
End If
 
 
 
ElseIf broj = 2 Then
 
 
 
DataGridView2.Rows(rednibroj).Cells(1).Value = Trim(DataGridView1.Rows(rednibroj * 3 + 1).Cells(1).Value.Replace(" ", ""))
 
 
 
broj = 3
 
 
 
ElseIf broj = 3 Then
 
DataGridView2.Rows(rednibroj).Cells(2).Value = Trim(DataGridView1.Rows(rednibroj * 3 + 2).Cells(1).Value.Replace(" ", ""))
 
 
 
broj = 1
 
End If
 
 
 
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.   
     Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.