This code
Public Sub tadieh_1()
If ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (0) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 0).Value
ElseIf ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (1) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 1).Value
ElseIf ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (2) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 2).Value
ElseIf ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (3) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 3).Value
ElseIf ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (4) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 4).Value
ElseIf ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (5) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 5).Value
ElseIf ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (6) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 6).Value
ElseIf ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (7) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 7).Value
ElseIf ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (8) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 8).Value
ElseIf ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (9) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 9).Value
ElseIf ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (10) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 10).Value
ElseIf ComboBoxEx1.SelectedIndex = (0) And ComboBoxEx2.SelectedIndex = (11) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 11).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (0) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 12).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (1) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 13).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (2) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 14).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (3) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 15).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (4) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 16).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (5) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 17).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (6) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 18).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (7) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 19).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (8) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 20).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (9) Then
TextBoxX2.Text = ShakhesDataGridView.Item(4, 21).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (10) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 22).Value
ElseIf ComboBoxEx1.SelectedIndex = (1) And ComboBoxEx2.SelectedIndex = (11) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 23).Value
ElseIf ComboBoxEx1.SelectedIndex = (2) And ComboBoxEx2.SelectedIndex = (0) Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, 24).Value
End If
End Sub
can be simplified, and replaced by
Public Sub tadieh_1()
Tmp= ComboBoxEx1.SelectedIndex * 12 + ComboBoxEx2.SelectedIndex
If Tmp <= 24 Then
TextBoxX2.Text = ShakhesDataGridView.Item(2, Tmp).Value
End If
End Sub
Otherwise, try to understand when there is no update, and use the debugger to track you code and see what is wrong.