mina.net
سه شنبه 04 فروردین 1388, 20:23 عصر
سلام دوستان ، سال نو مبارک
من در رویدادDataGridView2_CellValueChanged کد زیر رو نوشتم
If e.RowIndex < 0 Then Exit Sub
If e.ColumnIndex = 0 Or e.ColumnIndex = 1 Or e.ColumnIndex = 2 Or e.ColumnIndex = 6 Or e.ColumnIndex = 3 Then Exit Sub
Dim str4 As Double
Dim I As Integer = e.RowIndex
Dim str2 As Double
Dim str5 As Double
Dim str1 As Double
Try
str1 = DataGridView2.Rows(I).Cells(4).Value
Catch ex As Exception
str1 = 0
End Try
Try
str2 = DataGridView2.Rows(I).Cells(5).Value
Catch ex As Exception
str2 = 0
End Try
Try
str5 = DataGridView2.Rows(I).Cells(6).Value
Catch ex As Exception
str5 = 0
End Try
Dim str3 As Double = (str1 * str2) - str5
DataGridView2.Rows(e.RowIndex).Cells(7).Value = 0
DataGridView2.Rows(e.RowIndex).Cells(7).Value = str3
For I = 0 To (DataGridView2.RowCount - 2)
str3 = DataGridView2.Rows(I).Cells(7).Value
str4 += str3
Next
bol6 = True
TextBox6.Text = str4
وقتی به کد زیر میرسه
DataGridView2.Rows(e.RowIndex).Cells(7).Value = str3
خطا میده
An unhandled exception of type 'System.StackOverflowException' occurred in anbar.exe
دوستان برای رفع این مشکل باید چیکار کنم.
من در رویدادDataGridView2_CellValueChanged کد زیر رو نوشتم
If e.RowIndex < 0 Then Exit Sub
If e.ColumnIndex = 0 Or e.ColumnIndex = 1 Or e.ColumnIndex = 2 Or e.ColumnIndex = 6 Or e.ColumnIndex = 3 Then Exit Sub
Dim str4 As Double
Dim I As Integer = e.RowIndex
Dim str2 As Double
Dim str5 As Double
Dim str1 As Double
Try
str1 = DataGridView2.Rows(I).Cells(4).Value
Catch ex As Exception
str1 = 0
End Try
Try
str2 = DataGridView2.Rows(I).Cells(5).Value
Catch ex As Exception
str2 = 0
End Try
Try
str5 = DataGridView2.Rows(I).Cells(6).Value
Catch ex As Exception
str5 = 0
End Try
Dim str3 As Double = (str1 * str2) - str5
DataGridView2.Rows(e.RowIndex).Cells(7).Value = 0
DataGridView2.Rows(e.RowIndex).Cells(7).Value = str3
For I = 0 To (DataGridView2.RowCount - 2)
str3 = DataGridView2.Rows(I).Cells(7).Value
str4 += str3
Next
bol6 = True
TextBox6.Text = str4
وقتی به کد زیر میرسه
DataGridView2.Rows(e.RowIndex).Cells(7).Value = str3
خطا میده
An unhandled exception of type 'System.StackOverflowException' occurred in anbar.exe
دوستان برای رفع این مشکل باید چیکار کنم.