4
I have two classes created within the same namespace
, being:
public class Pessoa
{
public int idPessoa { get; set;}
public string nome { get; set;}
}
public class PessoaFisica
{
public Pessoa pessoa { get; set;}
public string cpf { get; set; }
public string rg { get; set; }
}
But when I try to use class PessoaFisica
, get the error message:
Undefined object reference for an object instance.
How do I instantiate the class Pessoa
within the class PessoaFisica
without having to use the operator new
?
The classes 'Person' and 'Personal', have the function of DTO. Consequently, they will be used by other classes of business rules to popularize the registration Datagrids of suppliers, customers and etc.
It worked, but working like this, Datagrid is filled but does not display the data...
– user8433
There is no mention of a Datagrid in the question. Why don’t you update the question with the Datagrid question and explain to us the purpose of Datagrid and its connection to People?
– Omni
@Omni, I updated the question as you suggest. Help?
– user8433
@user8433 yes help. As the Crood asked, the physical person fields were populated? You have to take into account that by default string type properties are null, that is, in Datagrid the fields will appear empty. Try giving a value to Cpf and rg when creating the list populating Datagrid and see if the data values appear.
– Omni
@Omni, I will proceed as you suggest and as soon as I have the result, put here. For now thank you.
– user8433
@user8433 one more suggestion, if you try and still can’t, edit the question and put the code in which you assign the Datagrid datasource.
– Omni