Click here to Skip to main content
15,894,038 members
Home / Discussions / C#
   

C#

 
AnswerRe: Create an object instance using System.Type Pin
tarasn17-Jan-06 3:09
tarasn17-Jan-06 3:09 
GeneralRe: Create an object instance using System.Type Pin
silverair17-Jan-06 4:37
silverair17-Jan-06 4:37 
GeneralRe: Create an object instance using System.Type Pin
Robert Rohde17-Jan-06 4:57
Robert Rohde17-Jan-06 4:57 
QuestionExcel Macro from C# Pin
pssuresh17-Jan-06 2:39
pssuresh17-Jan-06 2:39 
QuestionColor a row in a Datagrid, is there a solution that works with DataView? Pin
Cesa3717-Jan-06 2:28
Cesa3717-Jan-06 2:28 
AnswerRe: Color a row in a Datagrid, is there a solution that works with DataView? Pin
Robert Rohde17-Jan-06 5:01
Robert Rohde17-Jan-06 5:01 
AnswerRe: Color a row in a Datagrid, is there a solution that works with DataView? Pin
Cesa3717-Jan-06 6:46
Cesa3717-Jan-06 6:46 
Questionerror: key already exists Pin
dhol17-Jan-06 2:20
dhol17-Jan-06 2:20 
Hi

i am working in c# with infragistics
In c# windows applicaion, I will be passing data from textbox..such that
for example:i haev 3 texboxes labeled
name:
age:
salary:....
Now name is the parent and age and salary r the child..so if i pass data in
the appropriate textbox..It should be added in the ultrawintree.......such that
name(parent) should show up on the root node of the tree. and age and
salary(child) should show up under the root node.

I did this as follows..


//ultrawintree

private Infragistics.Win.UltraWinTree.UltraTree ultraTree1;


//form load

private void Form1_Load(object sender, System.EventArgs e)
{
DataSet dataSet = new DataSet();
//read the schema
dataSet.ReadXmlSchema("..\\..\\Menu.xsd");//menu.xsd contains name, age and salary
dataSet.WriteXml("..\\..\\resultdata.xml",XmlWriteMode.WriteSchema);
}


//buttton click

private void button1_Click(object sender, System.EventArgs e)
{
DataSet dataSet = new DataSet();


// Read the existing xml

dataSet.ReadXml("..\\..\\resultdata.xml");

//name textbox----string type

string strName = txtName.Text;


//age text box----int type

string strage = txtAge.Text;
int intAge;
if (!strAge.Equals(string.Empty)) // check to make sure the user entered something
intAge = Convert.ToInt32(strAge);

//Salary textbox------int type

string strSalary = txtSalary.Text;
int intSalary;
if (!strSalary.Equals(string.Empty)) // check to make sure the user entered something
intSalary = Convert.ToInt32(strSalary);



//create a new row

DataRow newrow;
newrow = dataSet.Tables[0].NewRow();

// add new row.
newrow["Name"] = strName;
newrow["Age"] = strAge;
newrow["Salary"] = strSalary;


//add parent node in ultrawintree

Infragistics.Win.UltraWinTree.UltraTreeNode anode = new Infragistics.Win.UltraWinTree.UltraTreeNode();
//add parent node
anode.Text = txtName.Text;

//add child nodes
anode.Nodes.Add(txtAge.Text);
anode.Nodes.Add(txtSalary.Text);

anode.Expanded = true;

ultraTree1.Nodes.Add(anode);




//add the row to the dataset

dataSet.Tables[0].Rows.Add(newrow);

//write the data to a xml file

dataSet.WriteXml("..\\..\\resultdata.xml", XmlWriteMode.WriteSchema);


dataSet.AcceptChanges();
MessageBox.Show("Saved");



}

so now when i run this program, as it reads a xml schema and creates a xml file.. now when i clicked the button, it checks for teh xml file and each textbox
is binded to teh xml elements..so that the data which is passed in the xml file willbe added in teh xml..

now for example i gave john,22,1800 for name,age and salary respectively
it is added inthge xml..no when i give rex, 22,1700again adn when i cick the button..it shows that key already exists..key:22..
so please help met o add this..wht should i do to overcome this error

dhol

QuestionIs it possible to create a dialog represent .NET JIT dialog when application error? Pin
god4k17-Jan-06 2:06
god4k17-Jan-06 2:06 
AnswerRe: Is it possible to create a dialog represent .NET JIT dialog when application error? Pin
Judah Gabriel Himango17-Jan-06 5:02
sponsorJudah Gabriel Himango17-Jan-06 5:02 
QuestionConversion to xml Pin
bidisha_tina17-Jan-06 2:03
bidisha_tina17-Jan-06 2:03 
AnswerRe: Conversion to xml Pin
exhaulted17-Jan-06 2:24
exhaulted17-Jan-06 2:24 
AnswerRe: Conversion to xml Pin
User 665817-Jan-06 4:38
User 665817-Jan-06 4:38 
QuestionCapture Icons Pin
Sabry190517-Jan-06 1:16
Sabry190517-Jan-06 1:16 
AnswerRe: Capture Icons Pin
Judah Gabriel Himango17-Jan-06 5:04
sponsorJudah Gabriel Himango17-Jan-06 5:04 
QuestionIterate through linked images in resource file Pin
Tommymo8117-Jan-06 1:10
Tommymo8117-Jan-06 1:10 
AnswerRe: Iterate through linked images in resource file Pin
CWIZO17-Jan-06 1:23
CWIZO17-Jan-06 1:23 
GeneralRe: Iterate through linked images in resource file Pin
Tommymo8117-Jan-06 1:50
Tommymo8117-Jan-06 1:50 
Questionedit the keyboard input stream Pin
Miromann17-Jan-06 1:01
Miromann17-Jan-06 1:01 
AnswerRe: edit the keyboard input stream Pin
DigitalKing17-Jan-06 5:01
DigitalKing17-Jan-06 5:01 
QuestionHow To Prevent Datagrid Row Deletion Pin
Anupbala17-Jan-06 0:54
Anupbala17-Jan-06 0:54 
AnswerRe: How To Prevent Datagrid Row Deletion Pin
Glaxalg17-Jan-06 5:37
Glaxalg17-Jan-06 5:37 
GeneralRe: How To Prevent Datagrid Row Deletion Pin
Anupbala19-Jan-06 3:00
Anupbala19-Jan-06 3:00 
GeneralRe: How To Prevent Datagrid Row Deletion Pin
Glaxalg19-Jan-06 4:57
Glaxalg19-Jan-06 4:57 
QuestionMy WinService refuses to startup .... Pin
MaWeRic17-Jan-06 0:39
MaWeRic17-Jan-06 0:39 

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.