Michael Corby
2008-06-24 22:28:12 UTC
Hi
The code below from a DLL compiles ok with BDS 2006.
Now it is giving error message with RAD Studio 2007.
extern "C"
{
// Insert/Modify Edit Routine
bool __declspec(dllexport) InsertModifyEdit(TADOQuery *qName, TForm
*fName, TBitBtn *bName)
{
String fldName, etd;
int etl;
bool allBlank;
bool emptyText;
if (qName->State == dsInsert || qName->State == dsEdit)
{
bName->ModalResult = mrOk; // Will close form
// Loop for all Components
int cCount = fName->ComponentCount;
for (int n=0; n<cCount; n++)
{
emptyText = false;
// TDBComboBox
if (fName->Components[n]->ClassNameIs("TDBComboBox"))
{
// Ignore test if tag set to > 0 ie 1
if (static_cast<TDBComboBox*>(fName->Components[n])->Tag == 0)
{
if (static_cast<TDBComboBox*>(fName->Components[n])->Text.IsEmpty())
{
static_cast<TDBComboBox*>(fName->Components[n])->Color = clYellow;
static_cast<TDBComboBox*>(fName->Components[n])->SetFocus();
fldName = static_cast<TDBComboBox*>(fName->Components[n])->DataField;
emptyText = true;
break;
}
}
}
// TDBLookupComboBox
if (fName->Components[n]->ClassNameIs("TDBLookupComboBox"))
{
// Ignore test if tag set to > 0 ie 1
if (static_cast<TDBLookupComboBox*>(fName->Components[n])->Tag == 0)
{
if
(static_cast<TDBLookupComboBox*>(fName->Components[n])->Text.IsEmpty())
{
static_cast<TDBLookupComboBox*>(fName->Components[n])->Color =
clYellow;
static_cast<TDBLookupComboBox*>(fName->Components[n])->SetFocus();
fldName =
static_cast<TDBLookupComboBox*>(fName->Components[n])->DataField;
emptyText = true;
break;
}
}
}
if (emptyText)
{
SubFunctMessageSound("Error");
MessageDlg("Entry required in " + fldName + " field",
mtError, TMsgDlgButtons() << mbOK,0);
bName->ModalResult = mrNone; // Form will remain open
return false;
}
}
return true;
}
}
//-----------------------------------------------------------------------------
Error message as follows :-
[ILINK32 Error] Error: Unresolved external '__fastcall
Dbctrls::TDBComboBox::GetDataField()' referenced from
C:\USERS\PUBLIC\DOCUMENTS\RAD
STUDIO\PROJECTS\DLLFILES\DEBUG_BUILD\DLLDBASE.OBJ
The TDBLookupComboBox is not giving an error.
Any help appreciated.
Michael Corby
The code below from a DLL compiles ok with BDS 2006.
Now it is giving error message with RAD Studio 2007.
extern "C"
{
// Insert/Modify Edit Routine
bool __declspec(dllexport) InsertModifyEdit(TADOQuery *qName, TForm
*fName, TBitBtn *bName)
{
String fldName, etd;
int etl;
bool allBlank;
bool emptyText;
if (qName->State == dsInsert || qName->State == dsEdit)
{
bName->ModalResult = mrOk; // Will close form
// Loop for all Components
int cCount = fName->ComponentCount;
for (int n=0; n<cCount; n++)
{
emptyText = false;
// TDBComboBox
if (fName->Components[n]->ClassNameIs("TDBComboBox"))
{
// Ignore test if tag set to > 0 ie 1
if (static_cast<TDBComboBox*>(fName->Components[n])->Tag == 0)
{
if (static_cast<TDBComboBox*>(fName->Components[n])->Text.IsEmpty())
{
static_cast<TDBComboBox*>(fName->Components[n])->Color = clYellow;
static_cast<TDBComboBox*>(fName->Components[n])->SetFocus();
fldName = static_cast<TDBComboBox*>(fName->Components[n])->DataField;
emptyText = true;
break;
}
}
}
// TDBLookupComboBox
if (fName->Components[n]->ClassNameIs("TDBLookupComboBox"))
{
// Ignore test if tag set to > 0 ie 1
if (static_cast<TDBLookupComboBox*>(fName->Components[n])->Tag == 0)
{
if
(static_cast<TDBLookupComboBox*>(fName->Components[n])->Text.IsEmpty())
{
static_cast<TDBLookupComboBox*>(fName->Components[n])->Color =
clYellow;
static_cast<TDBLookupComboBox*>(fName->Components[n])->SetFocus();
fldName =
static_cast<TDBLookupComboBox*>(fName->Components[n])->DataField;
emptyText = true;
break;
}
}
}
if (emptyText)
{
SubFunctMessageSound("Error");
MessageDlg("Entry required in " + fldName + " field",
mtError, TMsgDlgButtons() << mbOK,0);
bName->ModalResult = mrNone; // Form will remain open
return false;
}
}
return true;
}
}
//-----------------------------------------------------------------------------
Error message as follows :-
[ILINK32 Error] Error: Unresolved external '__fastcall
Dbctrls::TDBComboBox::GetDataField()' referenced from
C:\USERS\PUBLIC\DOCUMENTS\RAD
STUDIO\PROJECTS\DLLFILES\DEBUG_BUILD\DLLDBASE.OBJ
The TDBLookupComboBox is not giving an error.
Any help appreciated.
Michael Corby