Hello,
For last few days I'm trying everything to solve problem with this code but I still can't find any solution. Please, if you know what could it be, help.
There is code:
I got value of ArtikalId as well as DefCijena and StopaId but I don't get value of DefStopa. I checked names and values, there should be value of DefStopa.Code:Dim ArtikalId, StopaId As Integer Dim DefCijena, DefStopa As Double If Me.NarudzbeKupacaStavkeDgr.Columns(e.ColumnIndex).Name = "Artikal" Then ArtikalId = Me.NarudzbeKupacaStavkeDgr.Rows(e.RowIndex).Cells("Artikal").Value Dim ArtikliRedak As DataRow = Me.NarudzbeKupacaDataSet.Tables("ListaArtikli").Rows.Find(ArtikalId) If ArtikliRedak IsNot Nothing Then DefCijena = ArtikliRedak("ArtikalCijena") NarudzbeKupacaStavkeDgr.Rows(e.RowIndex).Cells("Cijena").Value = DefCijena StopaId = ArtikliRedak("ArtikalStopa") End If Dim StopeRedak As DataRow = Me.NarudzbeKupacaDataSet.Tables("SifarnikArtikli_StopePoreza").Rows.Find(StopaId) If StopeRedak IsNot Nothing Then DefStopa = StopeRedak("StopaStopa") NarudzbeKupacaStavkeDgr.Rows(e.RowIndex).Cells("PdvStopa").Value = DefCijena End If End If
When I put second part of this code, which should provide me value of DefStopa in try..catch like this:
I got message: "Object reference not set to an instance of an object".Code:Try Dim StopeRedak As DataRow = Me.NarudzbeKupacaDataSet.Tables("SifarnikArtikli_StopePoreza").Rows.Find(StopaId) DefStopa = StopeRedak("StopaStopa") NarudzbeKupacaStavkeDgr.Rows(e.RowIndex).Cells("PdvStopa").Value = DefStopa Catch ex As Exception MsgBox(ex.Message) End Try
Thanks in advance.




Reply With Quote