I created a WFA project that will serve as the basis for the rest, as follows:
I created a FormBase that has public control variables such as the operator name, date and time of access to the systems;
So far everything works fine.
My difficulty is in the FormBaseConsult class that I have a method to get the SQL string as follows:
public virtual string getSCriptConsulta()
{
sScriprtSQL = "";
return sScriprtSQL;
}
In the FormState class, which instance FormBaseConsult has a class that defines SQL:
public override string getSCriptConsulta()
{
return "select ufcodigo as codigo, " +
" ufsigla as uf, " +
" ufnome as estado " +
"from cadastros.tbestados " +
"order by ufnome ";
}
It's working fine, bringing the list of states, but I want to change some properties of the columns, for this I created a class as follows:
namespace wfaPraticandoHeranca
{
class EntidadeGridColumns
{
private string sFieldName = null;
private string sHeaderText = null;
private int iMinimumWidth = 0;
private string sToolTipText = null;
private int iWidth = 0;
private bool bFroze = false;
public string FieldName
{
get { return sFieldName; }
set { sFieldName = value; }
}
public string HeaderText
{
get { return sHeaderText; }
set { sHeaderText = value; }
}
public int MinimumWidth
{
get { return iMinimumWidth; }
set { iMinimumWidth = value; }
}
public string ToolTipText
{
get { return sToolTipText; }
set { sToolTipText = value; }
}
public int Width
{
get { return iWidth; }
set { iWidth = value; }
}
public bool Frozen
{
get { return bFroze; }
set { bFroze = value; }
}
}
}
In FormBaseConsult I created a class as follows:
public virtual EntidadeGridColumns getGridColumnsProperties()
{
EntidadeGridColumns colProperties = new EntidadeGridColumns[0];
return colProperties;
}
This class is reporting the error (with getGridColumnsProperties()
underlined in blue):
Error 3 Inconsistent accessibility: return type 'wfaPraticandoHeranca.EntidadeGridColumns' is less accessible than method 'wfaPraticandoHeranca.frmModeloConsultas.getGridColumnsProperties ()'
In FormConState I overwritten the class:
public override EntidadeGridColumns setColumnsProperties()
{
EntidadeGridColumns colProperties = new EntidadeGridColumns[3];
colProperties[0] = new EntidadeGridColumns();
colProperties[0].FieldName = "codigo";
colProperties[0].HeaderText = "Código";
colProperties[0].MinimumWidth = 75;
colProperties[0].Width = 75;
colProperties[0].ToolTipText = "Código do cadastro do Estado...";
colProperties[0].Frozen = true;
colProperties[1] = new EntidadeGridColumns();
colProperties[1].FieldName = "sigla";
colProperties[1].HeaderText = "Sigla";
colProperties[1].MinimumWidth = 60;
colProperties[1].Width = 60;
colProperties[1].ToolTipText = "UF do Estado...";
colProperties[1].Frozen = false;
colProperties[2] = new EntidadeGridColumns();
colProperties[2].FieldName = "estado";
colProperties[2].HeaderText = "Estado";
colProperties[2].MinimumWidth = 250;
colProperties[2].Width = 25;
colProperties[2].ToolTipText = "Nme do Estado...";
colProperties[2].Frozen = false;
return colProperties;
}
This class is reporting the error (with "getGridColumnsProperties ()" underlined in blue):
Error 2 Inconsistent accessibility: return type 'wfaPraticandoHeranca.EntidadeGridColumns' is less accessible than method 'wfaPraticandoHeranca.frmConstant.setColumnsProperties ()'
Finally, these are the mistakes I'm having, if you can help me I'll be grateful, as I have no idea how to solve this!
In my view, the EntidadeGridColumns
class can not be used as a method return and I do not know how to do it in C #.
Note: - Another error that is happening, since these are the error 2 and 3, the design of FormConState does not open more reporting the error:
> Connection string argument missing! Parameter name: Host
Mas executando tudo funciona devidamente; já excluí as pastas BIN e OBJ mas não deu certo. Já verifiquei no "Npgsql" este parâmetro "Host" e não encontre nada, apenas "Server".
Forgive me, I do not know how to set the Title for this situation.