I'm working in vb.net and trying to update dgv to list a customers name instead of ID. I already have all the functions to get the customer name given the id, so that isn't much of an issue. My issue is that when I load the DataGridView, it will only select the id.
Ideally, I would like to have it pull the Name while loading, but what I've been trying is running this AFTER it's loaded
For Each row As DataGridViewRow In dgvPhones.Rows
Dim customerID As String = ""
Dim customerName As String
Try
customerID = row.Cells("Customer").Value.ToString
Catch ex As Exception
End Try
customerName = CCCustomer.SelectByID(customerID).FirstNameLastName
row.Cells("Customer").Value = customerName
Next
I put a couple of breaks in and checked the IntelliTrace, and it's pulling in the correct values and all, but it's not actually overwriting the value in row.Cells("Customer"). It just keeps the original id number instead.
To make matters MORE confusing, I've done this before with an MEID/ESN Hex to Dec converter in the same exact place, using the exact same method, and it works just fine.
Can anybody see anything wrong with my code? I've tried using various combinations to see if it's failing because of a bad-value in the database, but it works for NULL/0/-1/1/""... so I'm kind of lost.