G
Guest
Hello
I'm new to this, and I'm not sure how to avoid the following error
I use the following code to pull data from a SQL database, depending on the choice selected in a listbox
Private Sub lBoxCP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lBoxCP.SelectedIndexChange
dim xyz as DataRowView = lBoxCP.SelectedIte
txtCPMain.Text = xyz("STR_CUTTING_PERMIT"
txtOArea.Text = xyz("STR_OPERATING_AREA"
and so on..
this works great as long as there is data in the field, but if it's empty, I get an error "Cast from 'DBNull' to 'string' is not valid
How do I have VB.NET just leave it blank
Thanks
Ambe
I'm new to this, and I'm not sure how to avoid the following error
I use the following code to pull data from a SQL database, depending on the choice selected in a listbox
Private Sub lBoxCP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lBoxCP.SelectedIndexChange
dim xyz as DataRowView = lBoxCP.SelectedIte
txtCPMain.Text = xyz("STR_CUTTING_PERMIT"
txtOArea.Text = xyz("STR_OPERATING_AREA"
and so on..
this works great as long as there is data in the field, but if it's empty, I get an error "Cast from 'DBNull' to 'string' is not valid
How do I have VB.NET just leave it blank
Thanks
Ambe