V
valliammai26
Guest
Hi,
I have write my code in vb.net. I have class shipping_address.
In the loop statement, the first data there is no any address. How to check nothing then assign the value for address1 ? Whenever i run i am getting null reference exception.
For Each obj In st.orders
Dim RefNo As Long = obj.id
Dim OrderDate As String = obj.created_at
Dim TotalAmt As Double = obj.total_price
Dim Email As String = obj.email
Dim CustName As String = obj.name
Dim TotalTax As Double = obj.total_tax
Dim TotalWeight As Long = obj.total_weight
Dim Remarks As String = obj.note
Dim FirstName As String = obj.customer.first_name
Dim LastName As String = obj.customer.last_name
Dim ShipCode As String = obj.shipping_lines(0).code
Dim ShipPrice As Double = obj.shipping_lines(0).price
Dim SAddress As String= obj.shipping_address.address1
Next
I have tried :
But failed :
Dim SAddress As String
If obj.shipping_address IsNot Nothing AndAlso _
obj.shipping_address.address1 = String.Empty Then
obj.shipping_address.address1 = SAddress
End If
Continue reading...
I have write my code in vb.net. I have class shipping_address.
In the loop statement, the first data there is no any address. How to check nothing then assign the value for address1 ? Whenever i run i am getting null reference exception.
For Each obj In st.orders
Dim RefNo As Long = obj.id
Dim OrderDate As String = obj.created_at
Dim TotalAmt As Double = obj.total_price
Dim Email As String = obj.email
Dim CustName As String = obj.name
Dim TotalTax As Double = obj.total_tax
Dim TotalWeight As Long = obj.total_weight
Dim Remarks As String = obj.note
Dim FirstName As String = obj.customer.first_name
Dim LastName As String = obj.customer.last_name
Dim ShipCode As String = obj.shipping_lines(0).code
Dim ShipPrice As Double = obj.shipping_lines(0).price
Dim SAddress As String= obj.shipping_address.address1
Next
I have tried :
But failed :
Dim SAddress As String
If obj.shipping_address IsNot Nothing AndAlso _
obj.shipping_address.address1 = String.Empty Then
obj.shipping_address.address1 = SAddress
End If
Continue reading...