Click here to Skip to main content
15,915,094 members
Home / Discussions / C#
   

C#

 
AnswerRe: Stuck Trying to erase lines drawn... Pin
Andy Brummer7-Sep-05 15:20
sitebuilderAndy Brummer7-Sep-05 15:20 
GeneralRe: Stuck Trying to erase lines drawn... Pin
Anonymous7-Sep-05 15:50
Anonymous7-Sep-05 15:50 
GeneralRe: Stuck Trying to erase lines drawn... Pin
Andy Brummer7-Sep-05 16:58
sitebuilderAndy Brummer7-Sep-05 16:58 
QuestionProblem with Database Pin
Expert Coming7-Sep-05 13:40
Expert Coming7-Sep-05 13:40 
AnswerRe: Problem with Database Pin
philip_cole7-Sep-05 13:53
philip_cole7-Sep-05 13:53 
GeneralRe: Problem with Database Pin
Expert Coming7-Sep-05 13:56
Expert Coming7-Sep-05 13:56 
QuestionGetting Time Changes Pin
monrobot137-Sep-05 12:15
monrobot137-Sep-05 12:15 
QuestionStrong name key file questions Pin
machocr7-Sep-05 11:34
machocr7-Sep-05 11:34 
AnswerRe: Strong name key file questions Pin
machocr7-Sep-05 12:29
machocr7-Sep-05 12:29 
QuestionCom+ Work as Web services Pin
webhay7-Sep-05 10:42
webhay7-Sep-05 10:42 
QuestionDrag & Drop to Windows Explorer Shell Pin
Judah Gabriel Himango7-Sep-05 9:49
sponsorJudah Gabriel Himango7-Sep-05 9:49 
AnswerRe: Drag & Drop to Windows Explorer Shell Pin
Judah Gabriel Himango7-Sep-05 11:35
sponsorJudah Gabriel Himango7-Sep-05 11:35 
QuestionInternal TCP traffic Pin
BeginnerC#7-Sep-05 9:37
BeginnerC#7-Sep-05 9:37 
AnswerRe: Internal TCP traffic Pin
Dario Solera7-Sep-05 22:08
Dario Solera7-Sep-05 22:08 
AnswerRe: Internal TCP traffic Pin
Dario Solera7-Sep-05 22:08
Dario Solera7-Sep-05 22:08 
GeneralRe: Internal TCP traffic Pin
BeginnerC#9-Sep-05 3:32
BeginnerC#9-Sep-05 3:32 
GeneralRe: Internal TCP traffic Pin
Dario Solera9-Sep-05 7:45
Dario Solera9-Sep-05 7:45 
QuestionAny One Using Verifinger SDK 4.2 for Thumb Project! Pin
majidbhutta7-Sep-05 8:10
majidbhutta7-Sep-05 8:10 
Questiondouble division Pin
Sasuko7-Sep-05 7:47
Sasuko7-Sep-05 7:47 
AnswerRe: double division Pin
Dan Neely7-Sep-05 7:56
Dan Neely7-Sep-05 7:56 
GeneralRe: double division Pin
Sasuko7-Sep-05 11:33
Sasuko7-Sep-05 11:33 
GeneralRe: double division Pin
Dave Kreskowiak7-Sep-05 13:43
mveDave Kreskowiak7-Sep-05 13:43 
Questionget the executable name witin a console exe Pin
Sasuko7-Sep-05 7:41
Sasuko7-Sep-05 7:41 
AnswerRe: get the executable name witin a console exe Pin
philip_cole7-Sep-05 12:12
philip_cole7-Sep-05 12:12 
QuestionUpdate XML file by DataSet problem. Pin
john_mcp7-Sep-05 6:11
john_mcp7-Sep-05 6:11 
Hi,

I'm writing a small program for friends that keeps track of their pet stock, and I cant find a solution to a problem with this code. I am updating an xml file through the DataSet.WriteXml method. Here is some code:

// This is the double click function for the list box control.
private void lvwTarantula_DoubleClick(object sender, System.EventArgs e)
{
try
{
ListViewItem selTarantula = this.lvwTarantula.SelectedItems[0];
int indexOfTarantulaSelected = selTarantula.Index;
DataRow rowTarantula = this.tblTarantulas.Rows[indexOfTarantulaSelected];
NewTarantula dlgTarantula = new NewTarantula();

dlgTarantula.txtScientificName.Text = (string)(rowTarantula["ScientificName"]);
dlgTarantula.txtCommonName.Text = (string)(rowTarantula["CommonName"]);
dlgTarantula.cboGenders.Text = (string)(rowTarantula["Gender"]);
dlgTarantula.dtpDatePurchased.Text = (string)(rowTarantula["DatePurchased"]);
dlgTarantula.txtPetName.Text = (string)(rowTarantula["PetName"]);
dlgTarantula.txtSize.Text = (string)(rowTarantula["Size"]);
dlgTarantula.txtStage.Text = (string)(rowTarantula["Stage"]);
dlgTarantula.dtpLastMolt.Text = (string)(rowTarantula["LastMolt"]);
dlgTarantula.MoltHistoryTbox.Text = (rowTarantula["MoltHistory"].ToString());
dlgTarantula.CommentsTbox.Text = (rowTarantula["Comments"].ToString());
dlgTarantula.PurchaseTbox.Text = (string)(rowTarantula["Purchase"].ToString());
dlgTarantula.PriceTbox.Text = (string)(rowTarantula["Price"].ToString());
dlgTarantula.SerialTbox.Text = (string)(rowTarantula["Serial"].ToString());
////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////////
string strNotify = (rowTarantula["CaptiveBred"].ToString());
bool bNotity = false;

if( strNotify == "True" ){bNotity = true;}

dlgTarantula.chkCB.Checked = bNotity;

dlgTarantula.btnCreate.Text = "Update";

if( dlgTarantula.MoltHistoryTbox.Text == "") // If CommentBox empty, enter first date.
{
dlgTarantula.MoltHistoryTbox.Text = dlgTarantula.dtpLastMolt.Value.ToString("d");
}

strLastMolt = dlgTarantula.dtpLastMolt.Value.ToString("d");

int found = dlgTarantula.MoltHistoryTbox.Find(strLastMolt); // Found equals string index.

if(found == -1 && found != 0) // If not found in CommentBox, add new date.
{
dlgTarantula.MoltHistoryTbox.AppendText(" " + strLastMolt);
}

if( dlgTarantula.ShowDialog() == DialogResult.OK )
{
rowTarantula["ScientificName"] = dlgTarantula.txtScientificName.Text;
rowTarantula["CommonName"] = dlgTarantula.txtCommonName.Text;
rowTarantula["Gender"] = dlgTarantula.cboGenders.Text;
rowTarantula["DatePurchased"] = dlgTarantula.dtpDatePurchased.Text;
rowTarantula["PetName"] = dlgTarantula.txtPetName.Text;
rowTarantula["Size"] = dlgTarantula.txtSize.Text;
rowTarantula["Stage"] = dlgTarantula.txtStage.Text;
rowTarantula["LastMolt"] = dlgTarantula.dtpLastMolt.Value.ToString("d");
rowTarantula["CaptiveBred"] = dlgTarantula.chkCB.Checked.ToString();
rowTarantula["MoltHistory"] = dlgTarantula.MoltHistoryTbox.Text;
rowTarantula["Comments"] = dlgTarantula.CommentsTbox.Text;
rowTarantula["Purchase"] = dlgTarantula.PurchaseTbox.Text;
rowTarantula["Price"] = dlgTarantula.PriceTbox.Text;
rowTarantula["Serial"] = dlgTarantula.SerialTbox.Text;

this.dsAddressBook.WriteXml(this.strFilename);
RefreshTarantula();
}
}
catch(System.ArgumentOutOfRangeException) // Catch exception ...
{
// ... do nothing.
}

// This function adds an Image path to the "Path" element in XML file.
private void mnuAddPic_Click(object sender, System.EventArgs e)
{
ListViewItem selTarantula = this.lvwTarantula.SelectedItems[0];
int indexOfTarantulaSelected = selTarantula.Index;
//DataRow rowTarantula = this.tblTarantulas.Rows[indexOfTarantulaSelected];
string strPath;

if( indexOfTarantulaSelected >= 0 )
{
DataRow rowTarantula = this.tblTarantulas.Rows[indexOfTarantulaSelected];
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter =
"Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*";
openFileDialog1.Title = "Open an Image file";

if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
strPath = openFileDialog1.FileName;
rowTarantula["Path"] = strPath;
this.dsAddressBook.WriteXml(this.strFilename);
RefreshTarantula();

}
}
}

The "Path" node in the XML file does not appear, and I cant figure out why.. Any help would be greatly appreciated.

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.