Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bookmarks in grid component

Status
Not open for further replies.

wimvanherp

Programmer
Mar 3, 2001
149
BE
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+&quot;, &quot;;
s = s + pDS->Fields->Fields[j]->AsString;

}
ListBox1->Items->Add(s);
s = &quot;&quot;
}
}
}
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
 
A couple of notes; First, put your code between
Code:
 and
marks or turn the &quot;Process TGML&quot; checkbox off. The reason is that tells TGML to put everything in italics so the on Items disappears and everything from then on is italicized. See the &quot;Process TGML&quot; link below for more examples.

Second, pDS->GotoBookmark((void *)DBGrid1->SelectedRows->Items.c_str()); must have the .c_str(). I didn't see it in you example but it is in the help file's example. See if that helps. James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Thanks a lot, now it works. You must have another helpfile (I use builder c++4) because in my help file it is wrong.

How life can be so nice when someone at the other side of the world (at least that's possible) takes care of your problems.

Wim Vanherp
Wim.Vanherp@myself.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top