I have a DataGridView that loads all the data from a table, all data is of Short Text type in the DB. I make the call by a SQL statement to display in the DataGridView, until that step goes well, everything is loaded and displayed perfectly!
The problem is when I select a record (whole line), and I ask to return this record to a form that has the respective fields so that I can edit them, so the fields in the form of type TextBox will quiet, but the error occurs when I try display the contents in a ComboBox. It is at this time that it gives the attached error, and such an error I can not solve.
InthisCombobox,only2itemsarerestricted,YESandNO.Withoutanysortofediting,justselecttheitemsfromthelist.
InModule:
PublicintCodigoFornecedorAsInteger''TBL_Cadastrar_FornecedoresNoForm:PrivateSubPSelecionaFornecedor()''GuardaoquefoiselecionadointCodigoFornecedor=CInt(dgvFornecedores.CurrentCell.Value.ToString())Me.Dispose()''ParaesconderoFormEndSubPrivateSubPSelecionaFornecedor()''GuardaoquefoiselecionadointCodigoFornecedor=CInt(CType(dgvFornecedores.CurrentRow().Cells("Codigo_Fornecedor").Value, String))
Me.Dispose() ''Para esconder o Form
End Sub
I have tried these two ways and I can not solve it, does anyone know?