Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
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.
QuestionC# vs. J#? Pin
Mridang Agarwalla7-Sep-05 6:00
Mridang Agarwalla7-Sep-05 6:00 
AnswerRe: C# vs. J#? Pin
Mohamad Al Husseiny7-Sep-05 7:34
Mohamad Al Husseiny7-Sep-05 7:34 
AnswerRe: C# vs. J#? Pin
Christian Graus7-Sep-05 13:19
protectorChristian Graus7-Sep-05 13:19 
AnswerRe: C# vs. J#? Pin
Dave Doknjas7-Sep-05 15:06
Dave Doknjas7-Sep-05 15:06 
QuestionAn easy question, an easy response Pin
Stanciu Vlad7-Sep-05 5:55
Stanciu Vlad7-Sep-05 5:55 
QuestionHardware serial numbers??? Pin
Dr_C#7-Sep-05 5:42
Dr_C#7-Sep-05 5:42 
AnswerRe: Hardware serial numbers??? Pin
Mohamad Al Husseiny7-Sep-05 5:59
Mohamad Al Husseiny7-Sep-05 5:59 
QuestionLazy initialization ok? Pin
Judah Gabriel Himango7-Sep-05 5:39
sponsorJudah Gabriel Himango7-Sep-05 5:39 
AnswerRe: Lazy initialization ok? Pin
Andy Brummer7-Sep-05 7:09
sitebuilderAndy Brummer7-Sep-05 7:09 
AnswerRe: Lazy initialization ok? Pin
Andy Brummer7-Sep-05 9:13
sitebuilderAndy Brummer7-Sep-05 9:13 
GeneralRe: Lazy initialization ok? Pin
Judah Gabriel Himango7-Sep-05 11:02
sponsorJudah Gabriel Himango7-Sep-05 11:02 
QuestionWindows Service Pin
BECK77-Sep-05 5:20
BECK77-Sep-05 5:20 
AnswerRe: Windows Service Pin
John Fisher7-Sep-05 8:17
John Fisher7-Sep-05 8:17 
Questionraw WM_INPUT for IR Controller Pin
Lapje7-Sep-05 5:19
Lapje7-Sep-05 5:19 
QuestionComposite Key constraint logic Pin
Anonymous7-Sep-05 3:36
Anonymous7-Sep-05 3:36 
AnswerRe: Composite Key constraint logic Pin
Guffa7-Sep-05 4:09
Guffa7-Sep-05 4:09 
GeneralRe: Composite Key constraint logic Pin
Anonymous7-Sep-05 6:36
Anonymous7-Sep-05 6:36 

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.