I thought I had things all working....WRONG
I have turned off Option Strict now..
This code copies data from a datagrid on the main form to a datagrid on the dataanalysis form... NOT ANYMORE.
It throws no errors and the confirmation messagebox pops up on the screen like it's supposed to if the data gets copied.
I can't see what's wrong with it...
I have turned off Option Strict now..
This code copies data from a datagrid on the main form to a datagrid on the dataanalysis form... NOT ANYMORE.
It throws no errors and the confirmation messagebox pops up on the screen like it's supposed to if the data gets copied.
I can't see what's wrong with it...
VB.NET:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
' Copy captured data to the DataAnalysis Form Datagridview
'Error Checking Start
DataAnalysis.DGV1.AllowUserToAddRows = True
If Me.RadioButton3.Checked = False And Me.RadioButton4.Checked = False Then
MessageBox.Show("Select Test Type [Intake or Exhaust]", " Data Analysis Functions", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Sub
ElseIf Me.TextBox15.Text = ("") Then
MessageBox.Show("Enter Starting Lift Value", " Data Analysis Functions", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Sub
ElseIf Me.TextBox16.Text = ("") Then
MessageBox.Show("Enter Increment Lift Value", " Data Analysis Functions", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Sub
ElseIf Me.TextBox17.Text = ("") Then
MessageBox.Show("The Set Lift Data Button Was Not Clicked", " Data Analysis Functions", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Sub
ElseIf DataGridView1.RowCount < (1) Then
MessageBox.Show("No Data To Process", " Data Analysis Functions", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Sub
End If
' ^^^^Data Error Checking End
'Capture Process Begins
For Each r As DataGridViewRow In DataGridView1.Rows
If r.IsNewRow Then Continue For
DataAnalysis.DGV1.AllowUserToAddRows = True
'r.Cells(0).Value is the current row's first column, r.Cells(1).Value is the second column, etc
Dataanalysis.DGV1.Rows.Add({r.Cells(0).Value, r.Cells(1).Value, r.Cells(2).Value, r.Cells(3).Value})
Next
For Each r As DataGridViewRow In Dataanalysis.DGV1.Rows
If r.IsNewRow Then Continue For
Select Case True
Case Me.RBtnPort1.Checked
If r.Cells(10) Is ("") Then
r.Cells(10).Value = Me.RBtnPort1.Text
End If
Case Me.RBtnPort2.Checked
If r.Cells(10) Is ("") Then
r.Cells(10).Value = Me.RBtnPort2.Text
End If
Case Me.RBtnPort3.Checked
If r.Cells(10) Is ("") Then
r.Cells(10).Value = Me.RBtnPort3.Text
End If
Case Me.RBtnPort4.Checked
If r.Cells(10) Is ("") Then
r.Cells(10).Value = Me.RBtnPort4.Text
End If
Case Me.RBtnPort5.Checked
If r.Cells(10) Is ("") Then
r.Cells(10).Value = Me.RBtnPort5.Text
End If
Case Me.RBtnPort6.Checked
If r.Cells(10) Is ("") Then
r.Cells(10).Value = Me.RBtnPort6.Text
End If
End Select
Next
numCols = Dataanalysis.DGV1.ColumnCount
numRows = Dataanalysis.DGV1.RowCount
currCell = Dataanalysis.DGV1.CurrentCell
If currCell.ColumnIndex >= 0 Then
If currCell.RowIndex < numRows - 1 Then
Dataanalysis.DGV1.CurrentCell = Dataanalysis.DGV1.Item(0, currCell.RowIndex + 1)
End If
Else
Dataanalysis.DGV1.CurrentCell = Dataanalysis.DGV1.Item(currCell.ColumnIndex, currCell.RowIndex + 1)
End If
Dataanalysis.DGV1.FirstDisplayedScrollingRowIndex = Dataanalysis.DGV1.RowCount - 1
MessageBox.Show("Captured Data Copied To Data Anaylsis Form", "Data Analysis Functions", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub