For i = 1 To dgvMedicine.RowCount - 1
If Me.dgvMedicine.CurrentRow.Cells(7).Value = "MBOX01" Then
Me.btnMedBox01.Enabled = True
ElseIf Me.dgvMedicine.CurrentRow.Cells(7).Value = "MBOX02" Then
Me.btnMedBox02.Enabled = True
.
.
.
.
.
ElseIf Me.dgvMedicine.CurrentRow.Cells(7).Value = "MBOX18" Then
Me.btnMedBox03.Enabled = True
ElseIf Me.dgvMedicine.CurrentRow.Cells(7).Value = "MBOX19" Then
Me.btnMedBox09.Enabled = True
ElseIf Me.dgvMedicine.CurrentRow.Cells(7).Value = "MBOX20" Then
Me.btnMedBox10.Enabled = True
End If
Next
Dim i As Integer = 0
With dgvMedicine
For i = 1 To dgvMedicine.RowCount - 1
If .Item(7, i).Value = "MBOX01" Then
Me.btnMedBox01.Enabled = True
ElseIf .Item(7, i).Value = "MBOX02" Then
Me.btnMedBox02.Enabled = True
ElseIf .Item(7, i).Value = "MBOX03" Then
Me.btnMedBox03.Enabled = True
.
.
.
.
Me.btnMedBox18.Enabled = True
ElseIf .Item(7, i).Value = "MBOX19" Then
Me.btnMedBox19.Enabled = True
ElseIf .Item(7, i).Value = "MBOX20" Then
Me.btnMedBox20.Enabled = True
End If
Next