Visual Studio Designer issue
Both have its own InitializeComponent with some controls initialized into them.
Both have a function connected to Load event.
In SolutionExplorer I click on formbase and everything works fine. When I click on derivedform, a list of errors appears. The errors are related to instructions included in formbase_Load.
If I empty formbase_Load (I clear all instructions into it), the designer can open it, instead.
I would like to use the designer on derivedform, without having to empty formbase_Load.
one of the instrucitons that cause a problem is, for example:
int [] diagData = Hex.StringToIntArray(strReturn);
look in the following code:
private void formbase_Load(object sender, EventArgs e)
{
btnOn.Enabled = false;
btnAbort.Enabled = false;
btnExit.Enabled = true;
btnOn.Visible = true;
btnAbort.Visible = true;
btnExit.Visible = true;
lbStato.Visible = true;
// INVIA
btnOn.Text = m_Ado2String.GetLangString("DiagEngineTest", 5, DefsECU.m_strDB_ECU, DefsECU.pwd);
// Esci
btnExit.Text = m_Ado2String.GetLangString("DiagEngineTest", 2, DefsECU.m_strDB_ECU, DefsECU.pwd);
// 25. Interrompi
btnAbort.Text = m_Ado2String.GetLangString("DiagEngineTest", 25, DefsECU.m_strDB_ECU, DefsECU.pwd);
string strCond = "WHERE cod = " + ((int)m_CodiceTest).ToString();
// nome della diagnosi
this.Text = m_Ado2String.GetGenericStringCampoLang(m_strTable, strCond, 0, "NomeBottone Italiano", true, 2, DefsECU.m_strDB_ECU, DefsECU.pwd);
// Dati per la personalizzazione della diagnosi ad uso variabile
string strReturn = m_Ado2String.GetGenericStringCampoLang(m_strTable, strCond, 0, "data", false, 0, DefsECU.m_strDB_ECU, DefsECU.pwd);
// Carico l'array dal db
int [] diagData = Hex.StringToIntArray(strReturn);
if (diagData.Length < this.nByteData2Send) // dev'essere almeno del numero di byte da spedire (poi ci possono essere i codici dei parametri da richiedere)
{
ErrorMessage.ShowIt(this, this.Text + "\n" +
// Test non configurato correttamente
m_Ado2String.GetLangString("AmbienteDiagnosi", 5, DefsECU.m_strDB_ECU, DefsECU.pwd) + "\n" +
// Numero di elementi richiesti in "data":
m_Ado2String.GetLangString("AmbienteDiagnosi", 6, DefsECU.m_strDB_ECU, DefsECU.pwd) + " " + nByteData2Send.ToString()
);
Close();
return;
}
this.data2send = new byte[this.nByteData2Send];
for (int i = 0 ; i < this.nByteData2Send ; i++)
this.data2send[i] = (byte)diagData[i];
lbByteSent.Text = Hex.BufferHexToString(this.data2send, 0, this.data2send.Length / 2) + "\n" +
Hex.BufferHexToString(this.data2send, this.data2send.Length / 2, this.data2send.Length - this.data2send.Length / 2);
this.Parametri = new Parametro[diagData.Length - this.nByteData2Send];
for (int idx = 0 ; idx < this.Parametri.Length ; idx++)
{
if (idx >= MAX_PARAMS) // per non andare ad agire su controls inesistenti (si arriva a labelParam10)
break;
this.Parametri[idx] = new Parametro(diagData[idx + this.nByteData2Send], (Label)this.groupBox1.Controls["label" + (idx + 1).ToString()], (TextBox)this.groupBox1.Controls["textBox" + (idx + 1).ToString()]);
}
// Nascondo i controls che non sono stati impostati nel database
for (int idx = this.Parametri.Length + 1 ; idx <= MAX_PARAMS ; idx++)
{
((Label)this.groupBox1.Controls["label" + idx.ToString()]).Visible = false;
((TextBox)this.groupBox1.Controls["textBox" + idx.ToString()]).Visible = false;
}
}
Visual studio 2005 .NET 2.0

