DataTable Edit Rows

G

Guest

I've searched and tried a few of the things I seen but nothing really helped
me. I am in visual studio 2003 and using visual c++. I created a table by
typing in the data inside the IDE. Inside the load event for the form I
added rows to the table

ataRow *myRow;

myRow = dataTable1->NewRow();
myRow->Item[COL_COMPONENTS] = S"X-Axis";
myRow->Item[COL_UNITS] = S"Inches";
dataTable1->Rows->Add(myRow);

myRow = dataTable1->NewRow();
myRow->Item[COL_COMPONENTS] = S"Y-Axis";
myRow->Item[COL_UNITS] = S"Inches";
dataTable1->Rows->Add(myRow);

Now I want to edit a row. Change a column that was previously set to a null
value.
What I have so far is
myRow = dataTable1->Rows->Item[rowNum];
myRow->BeginEdit();
myRow->Item[COL_CURRPOS] = tmp;
myRow->EndEdit();
dataTable1->AcceptChanges();

Where rowNum = a known index number of the row I want to change, and
COL_CURPOS is the column I want to make changes to. tmp is the variable
holding the value I want to post to that column of said row. I have tried
without the begin/end edit and without the acceptchanges... nothing seems to
result in the column on my table being changed?
 
W

William \(Bill\) Vaughn

At the point where you assign the value to the Row Item the data is in the
table. You don't need to call AcceptChanges. What evidence do you have that
the column value is not set? What is RowNum set to?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top