Quantcast
Viewing all articles
Browse latest Browse all 12583

Datagrid auto add rows and calculate Visual Basic

Dear friends and VB Master,

Please help me, I'm newbie at visual basic .net. I have a problem to calculate round robin schedule that I'm implemented it at datagridview. I have a data in dgv like this:

ProcessIDBurstTime

P140

P230

P310

What I want need is: the value from column2 will be reduced by 10 (minus 10), as long as the value not equal to 0, the dgv will add row at the last row with the reduced value (at column2).

So I want the result like this:

ProcessIDBurstTime

P140

P230

P310

-------------------------

P130

P220

P120

P210

P110

I try this code but it doesn't work (the value was false and only1 time process not continue):

Dim BT As System.Int32

Dim quantum As System.Int32 = 10

For m As Integer = 0 To Me.DataGridRR.Rows.Count - 2 Step 1
            BT = Val(DataGridRR.Rows(m).Cells("BurstTime").Value)
            If BT > 0 Then
                BT = BT - quantum
                Me.DataGridRR.Rows.Add(DataGridRR.Rows(m).Cells("ProcessID").Value, DataGridRR.Rows(m).Cells("BurstTime").Value = BT)
            End If
            BT = 0
        Next

Please help. Thanks


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>