wimvanherp
Programmer
Hallo,
has anybody experience with bookmarks in the dbridcomponent. I want to navigate through the fields I have selected in a grid and I used the example of the helpfile but this is not correct and does not compile
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (DBGrid1->SelectedRows->Count > 0)
{
AnsiString s = "";
TDataSet *pDS = DBGrid1->DataSource->DataSet;
for (int i=0; i < DBGrid1->SelectedRows->Count; i++)
{
pDS->GotoBookmark((void *)DBGrid1->SelectedRows->Items);
for (int j = 0; j < pDS->FieldCount; j++)
{
if (j>0)
s = s+", ";
s = s + pDS->Fields->Fields[j]->AsString;
}
ListBox1->Items->Add(s);
s = ""
}
}
}
this is the example of the helpfile but the line :
pDS->GotoBookmark((void *)DBGrid1->SelectedRows->Items)
always gives the error that it cannot cast a AnsiString to a void. So how do I use these bookmarks ?
Wim Vanherp
Wim.Vanherp@myself.com
has anybody experience with bookmarks in the dbridcomponent. I want to navigate through the fields I have selected in a grid and I used the example of the helpfile but this is not correct and does not compile
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (DBGrid1->SelectedRows->Count > 0)
{
AnsiString s = "";
TDataSet *pDS = DBGrid1->DataSource->DataSet;
for (int i=0; i < DBGrid1->SelectedRows->Count; i++)
{
pDS->GotoBookmark((void *)DBGrid1->SelectedRows->Items);
for (int j = 0; j < pDS->FieldCount; j++)
{
if (j>0)
s = s+", ";
s = s + pDS->Fields->Fields[j]->AsString;
}
ListBox1->Items->Add(s);
s = ""
}
}
}
this is the example of the helpfile but the line :
pDS->GotoBookmark((void *)DBGrid1->SelectedRows->Items)
always gives the error that it cannot cast a AnsiString to a void. So how do I use these bookmarks ?
Wim Vanherp
Wim.Vanherp@myself.com