|
thanks for replies
I've changed my app a bit.
to be more precisive, the XML document is like:
<app>
<appname>application1</appname>
<action><arg>argument1</arg><ges>gesture1</ges></action>
</app>
<app>
<appname>application2</appname>
<action><arg>argument2</arg><ges>gesture2</ges></action>
</app>
..etc
I'm choosing a node from my treeview first, and the node in the treeview has the name with "title" node's inner text, (so arg and ges nodes are siblings for the title)
what I'm doing right now is;
XmlDocument doc = new XmlDocument();
doc.Load();
XmlNode editing = doc.SelectSingleNode(treeView1.SelectedNode.Text);
editing.NextSibling.InnerText = "changedText";
in fact, application gives "Object reference not set to an instance of an object." message pointing the "XmlNode editing = doc.blahblah" line
any further help?
edit: there's also a <title>NodeTitle1/2</> tag among arg and ges nodes which I forgot to add to xml example
|
|
|
|
|
The problem lies on you SelectSingleNode line.
You have to treat XPath statements a bit like directory structures. Unless there's a top level node of that name you won't find it.
You can use \\ to denote any (this node and all below). Try the below:
XmlNode editing = doc.SelectSingleNode(@"\\" +treeView1.SelectedNode.Text);
Regards,
Rob Philpott.
|
|
|
|
|
yeah this seems like the answer, but I couldn't understand the string structure
I've pasted your line in my code and it still gives an error:
XPathException was unhandled:
'\\Applications' has an invalid token.
:/
|
|
|
|
|
um, try forward slashes rather than backslashes - my memory may be letting me down....
Regards,
Rob Philpott.
|
|
|
|
|
Thanks Rob you've been very helpful
but now another error occured in the next line,
XmlNode editing = dom.SelectSingleNode(@"//" + treeView1.SelectedNode.Text);
editing.NextSibling.InnerText = "changedText";
I promise, no more questions =))
|
|
|
|
|
Have a look at this Linq example.[^]
hmmm pie
|
|
|
|
|
Hi All,
I have generating a problem when i am tring to Copy Image in Clipboard.
Bitmap bmp1 = new Bitmap(panel3.ClientRectangle.Width, panel3.ClientRectangle.Height);
panel3.DrawToBitmap(bmp1, panel3.ClientRectangle);
Clipboard.SetImage(bmp1);
When i paste it on Paint and Print it then Image not Showing properly. Image is streatcing.
Thanks
If you can think then I Can.
|
|
|
|
|
In one form i added graphics using paint in the picture box, how can i get the same graphics in another form's picture box,at the same time graphics should run in both the forms using c#
modified on Tuesday, April 21, 2009 8:26 AM
|
|
|
|
|
Derive a class from Picture box and override the OnPaint handler. You can then just treat your new class as a control and drop it on whatever forms you want.
Regards,
Rob Philpott.
|
|
|
|
|
Hi,
I need to insert an instance of user defined class into a datarow in datatable.
I tried casting to the class name,object everything, but its always showing as string object. Anybody having any idea about this... A sample code is given below....
dataRow[dataColumn] = (MyClass)value;
Here value is an object of type MyClass...bt after execution, the result in dataRow[dataColumn] is of type string object..
Please help...its urgent...
|
|
|
|
|
How do you want your object to be inserted in the row?
|
|
|
|
|
Just want to insert it as class object...
foreach(MyClass obj in MyClassCollection)
{
dataRow[dataColumn] = obj;
}
Just this, nothing more... bt dis is showing as "MyClass" of type object{string}
|
|
|
|
|
what is the type of dataColumn?
|
|
|
|
|
I am not sure, but I think that it is using the ToString() method. As it is managing to store the class, I can only assume that the datacolumn type is one of the text variants (varchar, nvarchar etc.).
I think that you are going to have to use blob storage techniques, together with (possibly binary) serialization, to do this.
Maybe you will get lucky and someone who has done something like this will help.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
well i cant image you are wanting to display the class in any way in a cell so why dont you try using the Tag property of the DataRow? I am assuming you just need to get information from the class why you have a row selected.
dataRow.Tag = myClass;
then when you need it you can just do...
MyClass myClass = (MyClass)dataRow.Tag;
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
1. How do you know the value is a string?
2. The property indexer of DataRow is typed to return object, but you can cast it back to the original type.
|
|
|
|
|
hi,
I making a windows application in C# and my problem is that,
I have a square picture. I need to draw a circle on it, and everything
outside that circle to be set to a certain color, so the image looks framed
On other words, I want to crop a circle form a rectangular picture
Any hints/any help ..........
thanks in advance
|
|
|
|
|
Hi,
the Graphics class holds all you need: methods FromImage() and DrawEllipse() should do it.
You may use several DrawEllipse() with increasing radius to remove the four corners, or just one
with appropriate radius and Pen width.
|
|
|
|
|
thanks for give me such idea....
can you tell me how to fill color on the remaining portion of the image when we make a circle on it.
thanks.........
|
|
|
|
|
Make the Ellipse bigger than the picture and use a huge pen width.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
hi friends I am new to .NET,
I have the following code to save an image file in specific location.
It does compile and it is showing that null reference eexception is unhandled
it is asking to create an object instance in this line (System.Drawing.Imaging.ImageFormat)
how can it be done any help please
SaveFileDialog save = new SaveFileDialog();
save.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif";
save.Title = "Save the File";
save.ShowDialog();
string fName = save.FileName;
if (save.FileName != "")
{
System.IO.Stream fileStream = (System.IO.FileStream)save.OpenFile();
switch (save.FilterIndex)
{
case 1:
this.button7.Image.Save(fileStream, System.Drawing.Imaging.ImageFormat.Jpeg);
break;
case 2:
this.button7.Image.Save(fileStream, System.Drawing.Imaging.ImageFormat.Gif);
break;
case 3:
this.button7.Image.Save(fileStream, System.Drawing.Imaging.ImageFormat.Bmp);
break;
}
fileStream.Close();
}
}
|
|
|
|
|
I think the error is here:
vijaywithu wrote: System.IO.Stream fileStream = (System.IO.FileStream)save.OpenFile();
For whatever reason, the OpenFile has returned a null Stream (Did you press cancel?)
|
|
|
|
|
Two things:
1:
SaveFileDialog save = new SaveFileDialog();
save.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif";
save.Title = "Save the File";
if(save.ShowDialog() == DialogResult.OK) Use this to prevent exception on Cancel click
{
string fName = save.FileName;
if (save.FileName != "")
{
System.IO.Stream fileStream = (System.IO.FileStream)save.OpenFile();
switch (save.FilterIndex)
{
case 1:
this.button7.Image.Save(fileStream, System.Drawing.Imaging.ImageFormat.Jpeg);
break;
case 2:
this.button7.Image.Save(fileStream, System.Drawing.Imaging.ImageFormat.Gif);
break;
case 3:
this.button7.Image.Save(fileStream, System.Drawing.Imaging.ImageFormat.Bmp);
break;
}
fileStream.Close();
}
}
}
2: Set Buttons Image Property !!!
|
|
|
|
|
Hi
I have made a report to print a Bill. every thing is working properly but Hight of Table varries according to the no of items.
I m putting Partnos , description , qty, rate, total in TABLE BODY section.
I have used footer section of TABLE control for tax and total amount display.
I have fixed 8 rows/ page.
when 8 rows r in report Tax comes at right place but when 2 or 3 rows r thier then Tax section comes immediatly after item rows.
I want it to come at fix place.
PLease help me out this problem.
Thanks in advance.............
Amitendra
amitendra
|
|
|
|
|
Not sure if this is right, you have a footer to the TABLE that will be based on the table content. I think you need a PAGE footer to do the fixed position at the bottom of the page.
Never underestimate the power of human stupidity
RAH
|
|
|
|