|
Hello!
I'm using the well-known technique of handling unhandled thread level exceptions with a nice dialog, etc.
However, while it perfectly works on my PC, on a user's PC with just the framework installed, a generic Windows dialog pops up, showing just the "thread ID" and two choices: OK to Debug, Cancel to quit.
My question is: why doesn't it work?
|
|
|
|
|
I have seen this (but very long ago) on win98. I suggest u make sure all the .NET prerequisites are installed and then reinstall .NET just to be double sure!
top secret xacc-ide 0.0.1
|
|
|
|
|
System.Net.WebClient test = new System.Net.WebClient();<br />
test.DownloadFile("www.microsoft.com","D://test//index.aspx");
When I run this statement using my web program page to download my page to htm it gives me an error The remote server returned an error: (403) Forbidden. Please help me on how can I get around this one.
/dabuskol
|
|
|
|
|
Hello all.
I have a extrange behavior in my computer.
My regional configuration is Spanish ( Spain ) which means that the local decimal separator is ','.
If I run this code the results are
double d = 5.1;
string s = d.ToString (); //s= "5.1"
which is not the expected result ( it must be "5,1").
I have checked the value of
System.Threading.Thread.CurrentThread.CurrentCulture
and the culture is spanish-spain and the currency decimal separator is ','.
But the most extrang thing is that I have gone to the control panel, I have changed the local configuration to Catalonian, then without close the dialog I have changed another time to Spanish-Spain and after that the previous code works and the double is translated to "5,1".
Anyone have some similar problems ? Is this a bug of the framework. Can anyone help me ?
Best regards
Jose Vicente
|
|
|
|
|
I think that problem can be solved in Windows.
There are possibilities to change culture-settings in "control panel" -> "regional settings" -> "numbers" (At least Win2000).
There are many settings which you can change. Perhaps is Windows meaning that i Spain the standard seperator is '.'?
Try this and hope that this works...
If not, I´m sorry to reply this question, and forgot everything I wrote
Ciao
Norman-Timo
|
|
|
|
|
|
I have divided a form in two parts, first half contains a tree view control, in the next half there is a panel control, on
that I draw some controlls like check box, radio button, combo box, numeric up down, etc. at runtime, corresponding
to the node click of the tree view control.
In this case how and where should I store the status of each control?
e.g.
If there is a check box and a combo box corresponding to the node 1 and I click node 2, before drawing the controlls
corresponding to node 2 on the panel, where should I save the status of the controls corresponding to node 1 such
that when I again click node 1 , I should again get the old status of the controlls corresponding to it.
Please guide.
|
|
|
|
|
I´m not sure if I´m correct, but I think the best Method is to create for each node an own Object-Class. And in this class you are allowed to set values from your combobox, checkbox...
So you have to initialize your complete tree with all Object-Classes first, and then you´re able to switch between this classes.
Maybe I´m wrong, because I´m not so an experienced programmer.
So maybe I help you to find your own slution with this hint.
Your
Norman-Timo
|
|
|
|
|
I have to find out the maximum number of nodes for a child node
ex. my Xml is
<customers>
<customer id="c1">
<name>aaaa</name>
<job>Plumber</job>
<city>Hdddd</city>
<state>aaaaa</state>
</customer>
<customer id="c2">
<name>hhhhhhhh</name>
<job>hdfgdfgdf</job>
<city>dfgdfg</city>
<state>dfgdf</state>
</customer>
<customer id="c3">
<name>Memphis rays</name>
<job>
Car guy
<designation>dfsdfsd</designation>
</job>
<city>dfgdfgdfg</city>
<state>fgdfgdf</state>
</customer>
</customers>
Now the third customer node has a child to it's child (customer/job/designation) I need to find out that node, that has maximum children.. by reading the Xml file through C#.
Help!
<b>_____________________________________________________</b>
<b>Yea! I could be wrong...</b>
|
|
|
|
|
I think the best solution for this problem is to get the complete XML file with following instructions:
**************************************************
private static XmlDocument doc = new XmlDocument();
public XmlNode root;
using (StreamReader myTempFile = new StreamReader(xmlFile))
{
//read complete File into string
while ((rl = myTempFile.ReadLine()) != null)
{
tmpString += rl;
}
}
doc.LoadXml(tmpString);
root = doc.DocumentElement;
*************************************************
Now you have your complete XML-file in 'doc'. Additionally you have a root node.
Now you have to go through every node and check how many childs are available.
Something like:
*************************************************
int maxChildCount = 0;
int maxNodePos = 0;
int actNodePos = 0;
while (actNode != null)
{
actNodePos++;
int actChildCount = actNode.ChildNodes.Count;
if (maxChildCount < acthildCount)
{
maxchildCount = actChildCount;
maxNodePos = actNodePos;
}
actNode = actNode.NextSibling;
}
*************************************************
At the end you have the maxNodePos and the maxChildCount. At least you have to do is to start with your root-node and to step forward with 'actNode = actNode.NextSibling;' until your maxNodePos is reached.
I think it´s one solution and there are other possible, maybe faster to.
But I think it´s a solution.
Enjoy it, your
Norman-Timo
|
|
|
|
|
Yes thanx for the idea but the code is not working. I want to know the node that has only the root element as it's parent. I used this recusive fun.
public void readXml(XmlTextReader textReader)
{
string temp;
while(textReader.Read())
{
temp = textReader.Name;
n++;
Console.WriteLine(temp);
readXml(textReader);
}
}
but I want write down (Console.Write(...)) only for that node which has the max no. of child nodes.
Any more Ideas?
Please
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
Ok if I understand it correctly:
You want to have first level Nodes and especially that one with the most child nodes?
In your case the nodes with "customer id..."?
But than you can take the first part from my example (the part until you have the 'doc' XML file and your root node.
Than you can do it in an analogue way:
***************************************************
int maxChildCount = 0;
XmlNode mostChildNode = null;
actNode = root.FirstChild; // then you have the first customer node!
while (actNode != null)
{
if (maxChildCount < actNode.ChildNodes.Count)
{
maxChildCount = actNode.ChildNodes.Count;
mostChildNode = actNode;
}
actNode = actNode.NextSibling;
}
*************************************************
The reason that my program is not working is maybe the fact, that I typed in the source directly in this reply-form (sorry).
But you are certainly able to correct compiler errrors, I think. (if there are some)
I think with these line of code you have your solution, if I understand you right.
I´m sorry if I´m not correct again.
Norman-Timo
Edited:
By the way with what html tags can I highlite the code sources?
|
|
|
|
|
thanx I still have to try the second part, but I think loading the whole Xml document in a string in uneccary.. (I think). You can use the xmlTeaxtReader.Read(); method in the while loop right?
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
XPath!
eg XmlDocument.SelectNodes("nodename");
XPath syntax is beyond the scope of a forum post, I suggest you get the docs from the w3c. Its suprisingly not difficult and just looking at few examples will get you on the way.
Note: if you gonna using xmlns, then u need to specify an explicit prefix for the Xpath to work, and pass an XmlNamespaceManager instance to the function.
top secret xacc-ide 0.0.1
|
|
|
|
|
ok thanx.. I know a little bit of XPath, but I hav'nt used it in C#
Any tutorials on using it in C# please.
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
The problem I'm facing is as follows:
I have two classes: cBiquad and cFilter.
The cBiquad class has five properties that have get/set capabilities.
In the cFilter constructor, I have defined an array of cBiquad objects as follows:
cBiquad[] arrBiquads = null;
for ( i = 0; i < mnBiquads; i++ )
{
arrBiquads[i] = new cBiquad();
}
Now in one of the methods in the cFilter class - SetParameters(), no arguments - I need to set the five properties of the cBiquad objects.
However, when I attempt to do the following:
for ( i = 0; i < mnBiquads; i++ )
{
arrBiquads[i].Property1 = Prop1Value; //etc
}
I receive the following error message:
The name 'arrBiquads' does not exist in the class or namespace 'DSP.cFilter'
What should I do to get around this?
|
|
|
|
|
put this statement
<br />
cBiquad[] arrBiquads = null;<br />
outside of the constructor, instead of inside it. If it's inside the constructor it will only
be visible to code also in constructor.
<br />
public cFilter()<br />
{<br />
arrBiQuads = new cBiQuad[mnBiquads];<br />
for ( i = 0; i < mnBiquads; i++ )<br />
arrBiquads[i] = new cBiquad();<br />
}<br />
Hope it works better now..
|
|
|
|
|
If you define the array of cBiquad objects in the constructor it's only a local variable and no longer accessible as soon as the constructor scope is left.
You have to define a class variable for the array.
You will also have to initialize your array before you create it's members.
cBiquad[] arrBiquads = new cBiquad[mnBiquads];
for ( i = 0; i < mnBiquads; i++ )
{
arrBiquads[i] = new cBiquad();
}
www.troschuetz.de
|
|
|
|
|
Is there a designer like "the MMC Snap-in Designer for VB6" for any .NET environment?
|
|
|
|
|
hello
i am looking for a math algorithm or a code in c# to find a specific floating number in floating number limit and this in minimum tries(somthing short smart and simple)
thanks tzahi
|
|
|
|
|
hi ,
Ur question is incomplete. u have given the Range of ur output. ( within the limits of floating point values ). What are ur domains ? ( input ).
What u want exactly .
Praseed Pai
www.praseedpai.com
|
|
|
|
|
I'm trying to port some old C++ code to C#.
I have a few classes that were defined in a ".h" file. Their constructors and member variables were defined in the corresponding .cpp file.
What is the best way to port this file to C#. More specifically:
1. I assume that the class, its constructor and methods are all defined together as follows:
class DSP
{
// constructor
// methods
}
Is this correct?
2. The original C++ listing in the .h file is as follows:
class DSP
{
public:
// public variables
protected:
//constructor
// destructor
// private variables
void SomeMethod()
};
These public variables need to be properties that can be assigned to. Therefore in the C# implementation, do I need to define these fields with "get" and "set" properties?
I know these are very elementary questions, but I haven't ported any C++ code over to C# before, and I appreciate your help!
|
|
|
|
|
C# classes do not have header files, pretty much anything in the header can be discarded. The declaration of functions in C# is the same as the definition, and everything can automatically see the namespaces in the project, without having to include anything.
Yes, the best way to set properties is with get/set methods, then you can make variables that can be got and not set, and vice versa, if needed.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I have made a table using access , one of its coulumns is of the type
Hyperlink. I can't access it using Data grid on C#.
where I want to make it a link to a certain file or to read the file contentes of a certain row
|
|
|
|
|
Hello:
I recently changed my code around... being inexperienced and stupid, I had put code that replaced the connectionstring of an OleDbAdapter in the region that the designer obliterates when you make changes. But it worked.
Now I have moved the code to the form load event function, and the program cannot fill the dataset. I do not understand why at all. I have put in MessageBox.Show calls to show that the connectionstring is alright, so I am confused now as to what the problem is. Any ideas?
|
|
|
|