|
Read documentation from net on Menu control first, you come to know how to do it.
|
|
|
|
|
Double click on the menu button in your designer. This will create an EventHandler.
Inside the EventHandler, put the following code :
private void OpenFix_Click(object sender, System.EventArgs e)
{
Form2 fix = new Form2();
fix.Open();
}
|
|
|
|
|
please provide any sample code
|
|
|
|
|
Parent Form :
public ProgressBar pb;
private void openChild_Click(object sender, System.EventArgs e)
{
ChildForm cf = new ChildForm();
cf.pf = this;
cf.open();
}
Child Form :
public ParentForm pf;
private void runProgressBar_Click(object sender, System.EventArgs e)
{
for(int i = 0;i<100;i++)
{
pf.pb.Value++;
}
}
|
|
|
|
|
Ick, I hope that was intentionally ironic!
|
|
|
|
|
i want to update progressbar in Child form not in Parent form
|
|
|
|
|
Simplest method is to add events to your child form that the parent subscribes to when the form is created. You can then use these to notify the parent that the progress needs changing.
Any sample code? Here's Hello World as a Vax-11 macro[^]
|
|
|
|
|
Hi everyone!
I have got a problem with Chinese fonts displayed on Crystal Report pdf.
I have these fonts installed on the server system(East Asian language pack enabled) and I change the *.rpt file font in runtime, using Ms Song font...but when I generate pdf this font is not displaying(Sans serif have appeared instead of MS Song ) but the font of *.rpt has been changed to Ms Song I have checked it.
Did anyone have such problems?
I'll be very appreciated for any help!
|
|
|
|
|
Why cant i do this? The value of "args" will be of similar format to the value i assigned to it. Im getting a "Index was outside the bounds of the array" error
static void Main(string[] args)
{
args[0] = "FrGbWOfvwO0=";
}
|
|
|
|
|
I guess the args is not initialized with any length of you don't start your application with any arguments. Why do you want to add values to the args array inside your code anyway?
|
|
|
|
|
Because it would be pointless ? The args collection is passed in, and exists only inside this method, why would you have any desire to change it ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
There is no element in the array args if you don't run the program with a command-line parameter. Therefore, args[0] does not exist. 0 is out of range.
|
|
|
|
|
In a recursive function for traversing a tree nodes , I want to invoke a function for the last child of a parent node( including all its grandchilds ). I have not found a technique for finding that node in the recursive function .
Any help ?
Thanks in advance.
|
|
|
|
|
List<TreeNode> nodeList = new List<TreeNode>();
private List<TreeNode> GetChildNodes(TreeNode treeNode)
{
foreach (TreeNode oNode in treeNode.Nodes)
{
nodeList.Add(oNode);
if (oNode.Nodes.Count > 0)
{
GetChildNodes(oNode);
}
else {
// this is the last node
}
}
return nodeList;
}
This would give you list of nodes in order as they would appear in expanded tree view.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
modified on Friday, October 23, 2009 6:39 AM
|
|
|
|
|
How to find the last grandchild of a parent node. All nodes have just one last grandchild.
in the following example node "node1_child3_child3" is the last grandchild of node1. Then how can I recognize that node in the recursive function ? What technique can I use ?
----node1
node1_child1
node1_child2
node1_child2_child1
node1_child2_child2
node1_child3
node1_child3_child1
node1_child3_child2
node1_child3_child3
modified on Friday, October 23, 2009 6:53 AM
|
|
|
|
|
If you need just the last node, change the return type of the method to treenode and use following code:
nodeList.Add(treeNode);
if (treeNode.Nodes.Count > 0) {
treeNode = GetChildNodes(treeNode.Nodes[treeNode.Nodes.Count - 1]);
}
return treeNode;
If you need complete heirarchy, you the following:
nodeList.Add(treeNode);
if (treeNode.Nodes.Count > 0) {
GetChildNodes(treeNode.Nodes[treeNode.Nodes.Count - 1]);
}
return nodeList;
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I need to find the node while traversing the tree in the recursive function.
|
|
|
|
|
Isn't that recursion? GetChildNodes calling itself?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
yes but it gives me no way to identify the last grandchild of a node .
|
|
|
|
|
I used an addressing system for a similar problem(Drawing the tree)
here your address's woud be
0.0.0
0.1.0
0.2.0
0.2.1
0.2.2
0.3.0==node1_child3 Base node
0.3.1
0.3.2
0.3.3
**Would be 1.0.0... I think the answer is then obvious.
this pattern can then be applied to any depth of child...
|
|
|
|
|
Thanks for the reply. But I still don't get the approach ? can you elaborate please . The last grandchild here is 0.3.3.
How the traversing function would be then ?
|
|
|
|
|
here is an approximation since I don't know your exact structure:
<pre>
class address
{
list<int> token;
}
list<address> addresses = Tree.MapAddress();
int generation =0;
for(int i=0;i < addresses.Count-1;i++)
{
if(addresses[i+1].token[generation] > addresses[i].token[generation])
{ Console.Writeline("Your function result Here");} }
}
</pre>
Now I had some wonky recursion like I would need to skip children(closed leaf) and step into/out of children so you can navigate (almost as fast) using the address and recursion... but it takes a LOT of code. this is the smallest patch I can think of for your situation.
also you can change the generation by swapping out the generation number so if you wanted the line between great grand children and grand children switch 0->1, and voila.
modified on Friday, October 23, 2009 2:01 PM
|
|
|
|
|
ely_bob wrote: int generation =0;
for(int i=0;i < addresses.Count-1;i++)
{
if(addresses[i+1].token[generation] > addresses[i].token[generation])
{ Console.Writeline("Your function result Here");} }
}
What happend to the "generation" variable ? It is set to 0 and remains the same. Are you sure it is right ?
|
|
|
|
|
Yup.
That is a function stub, plop out that code and make a function with it:
myfunction(int generation){
for(int i=0;i < addresses.Count-1;i++)
{
if(addresses[i+1].token[generation] >addresses[i].token[generation])
{ Console.Writeline("Your function result Here");}
}
}}
just in case you want to reuse that code for say.. color coding your decendants.. you could use generation as the switch value so that your generations are all displayed in different colors... for example.
basically i just did it that way to show: that number can be set as a variable so you can get more mileage out of your code.
|
|
|
|
|
Hi all,
I am making a web application project. When the web application is run, the xml file will be always generated in a directory(app_data folder). The new xml file will overwrite the old one. I try to run with 2 browsers at once and one browser is successful and another one gets error and need to be refresh.
It is because the xml file is written by one application. So that I need to check the file status first when want to write. How to check the file status?Please include the code as it will very helpful for me. Thanks.
Regards,
Dedy
|
|
|
|