TrimTrom
May 26th, 1999, 09:16 AM
Hello,
VC++ 6.0 Prof, Windows 98
I hope some one can help me. I have just used the MSDBGrid ActiveX
control for the first time in the following way:
I have created a AppWizard application with one splitter bar dividing
the window in two. In the top section I have put a CFormView dialog
with a DBGrid in it, and below, a CEdit View. What I want to do is
every time the user changes row in the DBGrid, the CEdit View displays
related information from the same database.
To do this, I have done the following in the FormView DBGrid class:
void CPTDBGView::OnRowColChangeDbgrid1(VARIANT FAR* LastRow, short
LastCol)
{
// TODO: Add your control notification handler code here
CMsDgridCtrl* ldgptr = (CMsDgridCtrl*) GetDlgItem(IDC_DBGRID1);
CString lstri;
lstri = ldgptr->GetColumns(1);
MessageBox(lstri,"Text");
}
The above must look very basic to experts; I have used the RowColChange
event, and in there I have attempted to load a key field from the row
(which has four columns, by the way) into a CString. The trouble is, I
do not know which command in the DBGrid control retrieves a cell's
text: I have attempted to use GetColumns, above, with no success, to
load the first column's text.
I would be very grateful if someone could show me the code to retrieve
text from a DBGrid column, and load it into a CString.
Sincerely,
Paul Trimming
----------------------------------
Email: paul.trimming_nospam@dial.pipex.com
4, High St, Merstham
Surrey RH1 3EA, England
----------------------------------
VC++ 6.0 Prof, Windows 98
I hope some one can help me. I have just used the MSDBGrid ActiveX
control for the first time in the following way:
I have created a AppWizard application with one splitter bar dividing
the window in two. In the top section I have put a CFormView dialog
with a DBGrid in it, and below, a CEdit View. What I want to do is
every time the user changes row in the DBGrid, the CEdit View displays
related information from the same database.
To do this, I have done the following in the FormView DBGrid class:
void CPTDBGView::OnRowColChangeDbgrid1(VARIANT FAR* LastRow, short
LastCol)
{
// TODO: Add your control notification handler code here
CMsDgridCtrl* ldgptr = (CMsDgridCtrl*) GetDlgItem(IDC_DBGRID1);
CString lstri;
lstri = ldgptr->GetColumns(1);
MessageBox(lstri,"Text");
}
The above must look very basic to experts; I have used the RowColChange
event, and in there I have attempted to load a key field from the row
(which has four columns, by the way) into a CString. The trouble is, I
do not know which command in the DBGrid control retrieves a cell's
text: I have attempted to use GetColumns, above, with no success, to
load the first column's text.
I would be very grateful if someone could show me the code to retrieve
text from a DBGrid column, and load it into a CString.
Sincerely,
Paul Trimming
----------------------------------
Email: paul.trimming_nospam@dial.pipex.com
4, High St, Merstham
Surrey RH1 3EA, England
----------------------------------