Click here to Skip to main content
15,905,504 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When the checkbox is checked I want my "Mid Wk Call" to count as a N without showing and N in the datagridview textbox

Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit



    If e.ColumnIndex = 1 Then
            Dim IsChecked As Boolean = False
            IsChecked = CBool(DirectCast(DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("No Records"), DataGridViewCheckBoxCell).EditedFormattedValue)
            If IsChecked Then
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Att. (Y/N)").Value = "Y"
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Att. (Y/N)").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Mid. Wk. Call (Y/N)").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Wkly Sum. (Y/N)").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Shake /Cereal").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Entrees").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Bars").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Total").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Total V/F").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Total PA").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("TI (Y/N)").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("# days of RT").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("# days of Stretch").ReadOnly = True
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Weight Change").ReadOnly = True
            Else
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Att. (Y/N)").Value = ""
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Att. (Y/N)").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Mid. Wk. Call (Y/N)").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Wkly Sum. (Y/N)").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Shake /Cereal").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Entrees").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Bars").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Total").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Total V/F").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Total PA").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("TI (Y/N)").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("# days of RT").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("# days of Stretch").ReadOnly = False
                DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells("Weight Change").ReadOnly = False
            End If
        End If

    End Sub   

Dim countCall1 = 0
        Dim countCall2 = 0
        For Each r As DataRow In myTable.Rows
            Dim YesNo As String = r.Item("Mid. Wk. Call (Y/N)").ToString.ToUpper
            If YesNo = "Y" Then countCall1 += 1
            If YesNo = "N" Then countCall2 += 1
        Next
        Me.txtPhonecall.Text = Math.Round((countCall1 / (countCall1 + countCall2)) * 100,
Posted
Comments
CHill60 30-Aug-13 11:52am    
You've explained what you want but not what your problem is
PythonProgrammer 30-Aug-13 11:52am    
I don't know how to code what i want

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900