Updating TextBox Value Instantly rather than after Clicking on a Cell

  • Thread starter Thread starter Faisal2638
  • Start date Start date
F

Faisal2638

Guest
The TextBox besides Number of Courses in the Combo shows the sum of total values user puts in the Number of Courses column (please see the screenshot I added below). But heres the problem. When I put value in the cells of Number of Courses column, the TextBox besides Number of Courses in the Combo does not show (or add) the total value instantly. I need to click on any other cell in the DataGridView to see the updated result. What event should I use to display the total value in the TextBox instantly? Or what change should I make to see the updated result instantly rather than after clicking on any other cell?

I added codes and screenshots below. Regards.

Private Sub dg1FrmCourseNumber_CellStateChanged(sender As Object, e As DataGridViewCellStateChangedEventArgs) Handles dg1FrmCourseNumber.CellStateChanged
On Error Resume Next
Dim totalCourse, j, k, CoursetoRed, CoursetoIncr As Short
j = CShort(dg1FrmCourseNumber.RowCount - 1)
totalCourse = 0
For k = 0 To j
totalCourse = totalCourse + CShort(CStr(dg1FrmCourseNumber.Rows(k).Cells(4).Value.ToString))
Next
TextBox1.Text = totalCourse.ToString
CoursetoRed = CShort((Int(totalCourse / CShort(TextBox2.Text)) * CShort(TextBox2.Text)) - totalCourse)
CoursetoIncr = CShort(TextBox2.Text) + CoursetoRed
Label3.Text = "Course Adjustment: Reduce " & CoursetoRed * (-1) & " Or Increase " & CoursetoIncr.ToString & " Courses"
End Sub


2260d6ddfaac622089fb32bc21cd9d9b._.jpg




419382321c2f9f2ac2b27685987a00fc._.jpg

Faisal

Continue reading...
 
Back
Top