|
So I want to call the xpath function count(papers/id) on an XmlNode.
I try to call SelectSingleNode, but that throws an exception because count doesn't find xml nodes, it returns how many nodes there are.
How can I use the xpath count function on an XmlNode???
/\ |_ E X E GG
|
|
|
|
|
Why not use the SelectNodes function to get a set of nodes, and then use the Count property to see how many are returned?
int noOfIdNodes = theNode.SelectNodes("papers/id").Count
Kind regards - Jakob
Three kinds of people in the world:
- Those who can count..
- Those who can't!
|
|
|
|
|
yeahm this what I eventually figured out, thanks.
/\ |_ E X E GG
|
|
|
|
|
in some cases i want to get the errors number from sqlServer in C#, but i dont know how to do it.
please show me the way to catch it.
Thanks alot.
superdragon
|
|
|
|
|
try
{
}
catch (SqlException ex)
{
int errorCode = ex.ErrorCode;
}
Is that what you needed
|
|
|
|
|
Thanks for your helpings. Now i can catch it with your instruction
superdragon
|
|
|
|
|
hey guys whats up ? I have two questions that be glad if you can help me out.
1- I'm using this code to write make an xml file and move the results of my report to that file
DataSet.WriteXml(FileName, System.Data.XmlWriteMode.IgnoreSchema);
How can I change the header text in that file, is it something that can be done within a C# application ? if yes please tell me how ?!
2- About two weeks ago i posetd a thread that I got some helpful responds but still couldn't pull it off !?
I have two forms, in the first one I have a number that gets a value and i want to use it in the second form, can you please write me the code ?
Form 1
public int number;<br />
number = convert.toint32(number.text);
Form 2
Message.show(number.tostring());
Thanx very much
Mr.K
|
|
|
|
|
- I think you will have to reload the Xml file into something like the System.Xml.XmlDocument class and then perform the changes from there, resaving the changes
- Try using
number = int.Parse(number.Text);
Ed
|
|
|
|
|
well the thing is that I need to declare some kind of public method, because when I call Form1 f = new Form1(); the value for number would be erased !!!
how can I declare a public method for that ?
Mr.K
|
|
|
|
|
No, it's not being erased. You are creating a completely new form, so of course it won't contain the same data as the already existing form.
You just have to access the form that you already have instead of creating a new one.
---
b { font-weight: normal; }
|
|
|
|
|
mrkeivan wrote: public method
property...
mrkeivan wrote: how can I declare a public method for that ?
private Form1 f = new Form1();
public Form1 Form
{
get
{
return this.f;
}
}
Now when you access the property, use it like this:
MessageBox.Show(this.Form.number.ToString());
Ed
|
|
|
|
|
OK this code should be in my first form as a property, right ?
public Form1 Form{ get { return this.f; }}
can you please explain alittle more ?
Thanx
|
|
|
|
|
mrkeivan wrote: OK this code should be in my first form as a property, right ?
This code should be in the form which you are using to display the value, i.e. not the one with the property you're trying to access.
private Form1 f = new Form1();
public Form1 Form {
get {
return this.f;
}
}
This is a property definition, it defines a property called Form with type Form1 (i.e. your form). You cannot have a variable inside the get {...} construct otherwise it will be re-initialised everytime you access the property. Hence the private Form1 f declaration outside the property definition, this only creates a Form1 object once when the variable is initialised and then you can access this variable through the Form property (to get the number property you want.
NB: If you are doing the following:
One form (the "master" form) is in control of displaying the second ("input") and you want the master form to display the number property of the input form then you can do the following which is slightly simpler:
public class MasterForm : Form {
private Form1 inputForm = new Form1();
public void DisplayNumber() {
MessageBox.Show(this.inputForm.number.ToString());
}
}
This code ensures that by having the variable declared as global to the functions etc inside the MasterForm, the second Form1 is only created once.
Ed
|
|
|
|
|
So what I need to do is to create a .db file that will contain all thumbnails of pictures in the folder. I need to be able to save to this file and to load thumbnails from it.
I have to idea how to write for example several bitmaps to just one file and how to obtain them from it. Would you please help me or give links to some info?
Thanks in advance
|
|
|
|
|
You could zip al thsi thumbnalis into one file...
And then unzip when you need them.
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
yeah...that looks like an option, but there still should be a way how to do it using just one file
thanks anyway
|
|
|
|
|
If you will zip all your images then you will get one file...
you can also look at pk3 or make your onw format. You just have to find out a way to split different fiels inside your file...
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
great, yeah, I think i'll try this
and one more question, do you know where can I find examples of working with archives in c#? tried to search through MSDN but had no luck
|
|
|
|
|
|
hi every body cloud you give me the fastes way to update sql view in net.2???
best regards
|
|
|
|
|
As far as I know you can only select data from a view and you can not insert/update it.
You will have to update the actuall table(s) behind the view.
--------------------------------------------------------
My development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi all,
I have created a Web Service on a machine and i am creating
a windows application on another machine, i want to access the web service
from the first machine in the application on another machine.
i have created 2 projects in the win Application,
one is a windows app and another is a class library
Now i want to add the web reference to the web service in the class library
to access the methods exposed by the web service
but the problem here is as the class libraries namespace is winapp.classlib
and if i add the web service reference it does not shows the webservice name when i try to access it using classlib.webservice name
but if change the namespace of the class library project
i am able to access the methods of the webservice
can anyone tell me is it a problem of namespace or something else
Please help me out
Thanks,
Pramod
|
|
|
|
|
I have a UserControl that contains the property SelectedItem. I want to expose that property at design time. The property is of type SomeClass (just an example). At design time I want the user to be able to set the SelectedItem property to ONLY one of the instances of SomeClass contained in a List. How can I go about doing this?
public class MyTestControl : UserControl
{
private List<SomeClass> myList = new List<SomeClass>();
SomeClass _mySelectedItem;
public MyTestControl()
{
myList.Add(new SomeClass());
myList.Add(new SomeClass());
myList.Add(new SomeClass());
}
[Browsable(true)]
public SomeClass SelectedItem
{
get
{
return _mySelectedItem;
}
set
{
_mySelectedItem = true;
}
}
}
-Mike.
|
|
|
|
|
I draw some PCB(printed circuit board) use float points ArrayList on panel_paint(not scrollable),
(method 1)write MouseWheel Event ,
(method 2)and use a rubber band (a focus rectangle that tracks with the mouse pointer)to amplify the graph.
however ,when I amplify the graph a few times,the OutOfMemeryException threw;The exception is more likely to throw when I use method 2.
I heard the .Net Framework has a bug in Graphics when use float array,is this true.How can I solve my question?
Thanks for your answers.
|
|
|
|
|
hi,
frendz this is sasi,i am getting date format in c#.net as mm/dd/yyy.
but i want to get it in this format...dd/mm/yyyy.
regards,
sasi
|
|
|
|