|
-
May 24th, 2005, 03:54 PM
#1
Thread Starter
Lively Member
Re: DataGrid Help . . .
We're on the right track now...I get:
An unhandled exception of type 'System.NullReferenceException' occurred in MyApplication.exe
Additional information: Object reference not set to an instance of an object.
And it hi-lites the first line in yellow. If I comment out the first line, it hi-lites the second line, and so on.
'pm' is the main form of my solution (not the one in focus now), the form I'm working on has a datagrid with a select and a cancel button beneath it. The idea is to select a row in the datagrid, and move the data in that row to the textboxes on the main form. I suspect I'm handling the move to the main form wrong, but I'm not sure.
VB Code:
Private Sub btnCustSearchSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustSearchSelect.Click
Dim pm As PartsManager
'Crashes on this line first
pm.txtCustomerName.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 0)
pm.txtCustomerNumber.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 1)
pm.txtCustomerAddress.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 2)
pm.txtCustomerAddress2.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 3)
pm.txtCustomerPOBox.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 4)
pm.txtCustomerCity.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 5)
pm.txtCustomerState.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 6)
pm.txtCustomerZip.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 7)
pm.txtCustomerContact.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 8)
pm.txtCustomerPhone.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 9)
pm.txtCustomerNotes.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 10)
pm.txtCustomerLastUpdate.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 11)
pm.txtCustomerUpdatedBy.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 12)
pm.chkCustShipTo.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 13)
pm.chkCustKeepInventory.Text = grdCustSearchResults.Item(grdCustSearchResults.CurrentRowIndex, 14)
Me.Close()
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|