Click here to Skip to main content
15,916,702 members
Home / Discussions / C#
   

C#

 
QuestionValidating Data in a datagridView Pin
Rocky#16-Feb-07 20:11
Rocky#16-Feb-07 20:11 
AnswerRe: Validating Data in a datagridView Pin
iylbq24716-Feb-07 22:11
iylbq24716-Feb-07 22:11 
GeneralRe: Validating Data in a datagridView Pin
Rocky#17-Feb-07 23:28
Rocky#17-Feb-07 23:28 
Questionwriting to a text file that may not exsist Pin
alostdruid16-Feb-07 18:47
alostdruid16-Feb-07 18:47 
AnswerRe: writing to a text file that may not exsist Pin
Stefan Troschuetz16-Feb-07 20:51
Stefan Troschuetz16-Feb-07 20:51 
AnswerRe: writing to a text file that may not exsist Pin
Wayne Phipps17-Feb-07 3:34
Wayne Phipps17-Feb-07 3:34 
QuestionCube and Data mining on Forms, how? Pin
TrooperIronMan16-Feb-07 14:49
TrooperIronMan16-Feb-07 14:49 
QuestionDataGridView - Bound to XMLDataDoc [modified] Pin
CopperMedal16-Feb-07 14:20
CopperMedal16-Feb-07 14:20 
I'm new to C#, so please bear with me on terminology(and spelling). I have a small example application with a form that tries to bind XMLDataDoc instances to a DataGridView. I swap in and out the instances of XMLDataDocs to my DataGridView, depending on which data I’m working with at the time.

My problem is that I can’t seem to control when to actually commit the data to my XMLDataDoc instances. At first when I was learning about binding between DataGridView and XmlDataDoc objects, I thought there was an intrinsic instant updating of the data to the XMLDataDoc when one changes data in the DataGridView, but I’m not able to understand when or where exactly this happens. The commit success is not consistent, in fact I can only get it to happen when add new data to the target row, then click into a new row, and then save.

I’m binding to my DataGridView:
newDataClass1.XmlDataDoc.Load(some_XMLFile_on_a_drive);

BindingSourceVaultItem.DataSource = newDataClass1.XmlDataDoc.DataSet.Tables["ItemColumn"];

DataGridView.DataSource = BindingSourceVaultItem;

If I then create a another XMLDataDoc instance and bind it to the DataGridView:

BindingSourceVaultItem.DataSource = newDataClass2.XmlDataDoc.DataSet.Tables["ItemColumn"];


The DefaultValuesNeeded event populates all the key data, except the itemColumn, which has its column value AutoIncrement set to true. Together, they satisfy my schema rules.

My issue is that after trying to change data within a new row of the DataGridView, and then trying to save data off to an XML file, I receive a “root element” error. I put in a DataGridView.CommitEdit() in the CurrentCellDirtyStateChanged event, in hopes to push the data at the cell level.

Am I using BindSource incorrectly for multiple XMLDataDoc instances? Any help is greatly appreciated and thanks in advance.



AnswerRe: DataGridView - Bound to XMLDataDoc Pin
CopperMedal17-Feb-07 8:07
CopperMedal17-Feb-07 8:07 
Questionfile transfer Pin
giltendezm16-Feb-07 14:16
giltendezm16-Feb-07 14:16 
AnswerRe: file transfer Pin
Niiiissssshhhhhuuuuu16-Feb-07 16:47
Niiiissssshhhhhuuuuu16-Feb-07 16:47 
GeneralRe: file transfer Pin
giltendezm16-Feb-07 18:01
giltendezm16-Feb-07 18:01 
GeneralRe: file transfer Pin
Niiiissssshhhhhuuuuu16-Feb-07 19:18
Niiiissssshhhhhuuuuu16-Feb-07 19:18 
GeneralRe: file transfer Pin
Niiiissssshhhhhuuuuu16-Feb-07 19:27
Niiiissssshhhhhuuuuu16-Feb-07 19:27 
GeneralRe: file transfer Pin
giltendezm16-Feb-07 19:49
giltendezm16-Feb-07 19:49 
GeneralRe: file transfer Pin
Niiiissssshhhhhuuuuu16-Feb-07 19:56
Niiiissssshhhhhuuuuu16-Feb-07 19:56 
QuestionExcel ListObject to XmlDocument C# [modified] Pin
Raghutoo16-Feb-07 13:13
Raghutoo16-Feb-07 13:13 
QuestionDateTime Pin
Expert Coming16-Feb-07 12:37
Expert Coming16-Feb-07 12:37 
AnswerRe: DateTime Pin
Guffa16-Feb-07 13:58
Guffa16-Feb-07 13:58 
QuestionRemoving a " from a string Pin
sharpiesharpie16-Feb-07 12:16
sharpiesharpie16-Feb-07 12:16 
AnswerRe: Removing a " from a string Pin
Christian Graus16-Feb-07 12:18
protectorChristian Graus16-Feb-07 12:18 
GeneralRe: Removing a " from a string Pin
sharpiesharpie16-Feb-07 12:45
sharpiesharpie16-Feb-07 12:45 
GeneralRe: Removing a " from a string Pin
Christian Graus18-Feb-07 9:09
protectorChristian Graus18-Feb-07 9:09 
AnswerRe: Removing a " from a string Pin
Guffa16-Feb-07 14:01
Guffa16-Feb-07 14:01 
GeneralRe: Removing a " from a string Pin
sharpiesharpie16-Feb-07 15:46
sharpiesharpie16-Feb-07 15:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.