J
jasonMc
Hey There,
Objective: To let the user to select a file through a openFileDialog
in c# then storing that information eg. Filename, Filepath and Date
Added to a xml file..
Im using Visual Studio 2008, here is an example of what im trying to
do this code works however i dont use a openFileDialog to select the
file hense :"E:\\blah";
DialogAddTo.Title = "Add Image to Dir to view";
DialogAddTo.InitialDirectory = "E:\\Primal\
\Images\\";
DialogAddTo.Filter = "JPG| *.jpg";
DialogAddTo.Multiselect = false;
String fileNameToAdd = "E:\\blah";
DialogAddTo.Dispose
(); viwDataDS.imagesTable.AddimagesTableRow
(fileNameToAdd.Substring(fileNameToAdd.LastIndexOf("\\") + 1).ToString
(),
fileNameToAdd.ToString(),
DateTime.Now);
viwDataDS.imagesTable.WriteXml("test.xml",
XmlWriteMode.WriteSchema);
When instead i use a fileDialogBox it doesnt work
although all i do
is add in the line showDialog i dont even use it. (but ofcourse i want
to im just stressing the point)
DialogAddTo.InitialDirectory = "E:\\Primal\\Images\\";
DialogAddTo.Filter = "JPG| *.jpg";
DialogAddTo.Multiselect = false;
DialogAddTo.ShowDialog();
String fileNameToAdd = "E:\\blah";
DialogAddTo.Dispose
(); viwDataDS.imagesTable.AddimagesTableRow
(fileNameToAdd.Substring(fileNameToAdd.LastIndexOf("\\") + 1).ToString
(),
fileNameToAdd.ToString(),
DateTime.Now);
viwDataDS.imagesTable.WriteXml("test.xml",
XmlWriteMode.WriteSchema);
Oh and hense:
viwDataDS is the dataSet im using.. (this updates fine in both
occurances just the 2nd doesnt write the xml file
)
DialogAddTo is my openFileDialog
if anyone has any idea on my problem please post back spent hours
trying to debug it
.
oh and the DialogAddTo i added to the form to create it.
Cheers
Jason
Objective: To let the user to select a file through a openFileDialog
in c# then storing that information eg. Filename, Filepath and Date
Added to a xml file..
Im using Visual Studio 2008, here is an example of what im trying to
do this code works however i dont use a openFileDialog to select the
file hense :"E:\\blah";
DialogAddTo.Title = "Add Image to Dir to view";
DialogAddTo.InitialDirectory = "E:\\Primal\
\Images\\";
DialogAddTo.Filter = "JPG| *.jpg";
DialogAddTo.Multiselect = false;
String fileNameToAdd = "E:\\blah";
DialogAddTo.Dispose
(); viwDataDS.imagesTable.AddimagesTableRow
(fileNameToAdd.Substring(fileNameToAdd.LastIndexOf("\\") + 1).ToString
(),
fileNameToAdd.ToString(),
DateTime.Now);
viwDataDS.imagesTable.WriteXml("test.xml",
XmlWriteMode.WriteSchema);
When instead i use a fileDialogBox it doesnt work
![Frown :( :(](/styles/default/custom/smilies/frown.gif)
is add in the line showDialog i dont even use it. (but ofcourse i want
to im just stressing the point)
DialogAddTo.InitialDirectory = "E:\\Primal\\Images\\";
DialogAddTo.Filter = "JPG| *.jpg";
DialogAddTo.Multiselect = false;
DialogAddTo.ShowDialog();
String fileNameToAdd = "E:\\blah";
DialogAddTo.Dispose
(); viwDataDS.imagesTable.AddimagesTableRow
(fileNameToAdd.Substring(fileNameToAdd.LastIndexOf("\\") + 1).ToString
(),
fileNameToAdd.ToString(),
DateTime.Now);
viwDataDS.imagesTable.WriteXml("test.xml",
XmlWriteMode.WriteSchema);
Oh and hense:
viwDataDS is the dataSet im using.. (this updates fine in both
occurances just the 2nd doesnt write the xml file
![Frown :( :(](/styles/default/custom/smilies/frown.gif)
DialogAddTo is my openFileDialog
if anyone has any idea on my problem please post back spent hours
trying to debug it
![Frown :( :(](/styles/default/custom/smilies/frown.gif)
oh and the DialogAddTo i added to the form to create it.
Cheers
Jason