Click here to Skip to main content
15,905,874 members
Home / Discussions / C#
   

C#

 
GeneralRe: Balloon Tooltip Limitations... Pin
Robert Rohde10-Jul-06 23:47
Robert Rohde10-Jul-06 23:47 
QuestionA recursive quastion? Pin
ytubis10-Jul-06 12:45
ytubis10-Jul-06 12:45 
AnswerRe: A recursive quastion? Pin
Malcolm Smart10-Jul-06 20:50
Malcolm Smart10-Jul-06 20:50 
Questioncan't get OpenNLP model files Pin
mauraj10-Jul-06 12:25
mauraj10-Jul-06 12:25 
QuestionRunning as admin/system user on compact framework. Pin
f.vanvugt10-Jul-06 11:20
f.vanvugt10-Jul-06 11:20 
AnswerRe: Running as admin/system user on compact framework. Pin
LongRange.Shooter11-Jul-06 8:59
LongRange.Shooter11-Jul-06 8:59 
GeneralRe: Running as admin/system user on compact framework. Pin
f.vanvugt11-Jul-06 21:30
f.vanvugt11-Jul-06 21:30 
QuestionHELP! Processor at 100% Pin
Rabbit1710-Jul-06 11:19
Rabbit1710-Jul-06 11:19 
I have a datagrid with a dataset table as it's datasource and a tree with a copy of the original dataset table as it's datasource. The datagrid dataset can be changed, but the tree needs to stay constant.

This is for a biology app. After I add nodes for each Family\Genus\Species to the tree I want to go back through it and add a (number) after each node to designate how many collections are under each node.

This works fine on faster processors but not on slower as the processors hit 100% and take up to 8 minutes to run. It takes 8 seconds when it doesn't hit 100%.

Here is the code that adds the (number) after each node:

public void AddCollectionsToNodes()
{
this.collectionTree.SuspendLayout();
this.CollectionsDataGrid.SuspendLayout();

string oldFilter = "";
if(dsCollections.Tables[0].DefaultView.RowFilter != null)
{
oldFilter = dsCollections.Tables[0].DefaultView.RowFilter;
}
try
{
foreach(TreeNode all in this.collectionTree.Nodes)
{
foreach(TreeNode family in all.Nodes)
{
string filter = "";
if(oldFilter.Trim().Length > 0)
{
filter = oldFilter + " AND Family_Name='" + family.Text + "'";
}
else
{
filter = "Family_Name='" + family.Text + "'";
}
dsCollections.Tables[0].DefaultView.RowFilter = filter;
int rowCount = dsCollections.Tables[0].DefaultView.Count;
family.Text += " (" + rowCount + ")";
if(rowCount > 0)
{
foreach(TreeNode genus in family.Nodes)
{
int count = 0;
for(int i = 0; i < rowCount; i++)
if(dsCollections.Tables[0].DefaultView[i]["Genus_Name"].ToString().Trim() == genus.Text.Trim())
count++;
genus.Text += " (" + count + ")";
if(count > 0)
{
foreach(TreeNode species in genus.Nodes)
{
count = 0;
for(int i = 0; i < rowCount; i++)
if(dsCollections.Tables[0].DefaultView[i]["Specific_Epithet"].ToString().Trim() == species.Text.Trim())
count++;
species.Text += " (" + count + ")";
if(count > 0)
{
foreach(TreeNode infra in species.Nodes)
{
count = 0;
for(int i = 0; i < rowCount; i++)
if(dsCollections.Tables[0].DefaultView[i]["Infra_Epithet"].ToString().Trim() == infra.Text.Trim())
count++;
infra.Text += " (" + count + ")";
}
}
}
}
}
}
}
}
}
catch ( System.Exception e)
{
MessageBox.Show (String.Format ("Error: {0}", e.Message), "Add Number of Collections to Family Nodes");
}

dsCollections.Tables[0].DefaultView.RowFilter = oldFilter;

this.collectionTree.ResumeLayout();
this.CollectionsDataGrid.ResumeLayout();
this.collectionTree.Nodes[0].Expand();
}

Thanks for any ideas!

RABB17
AnswerRe: HELP! Processor at 100% Pin
Not Active10-Jul-06 11:43
mentorNot Active10-Jul-06 11:43 
GeneralRe: HELP! Processor at 100% Pin
Rabbit1710-Jul-06 12:07
Rabbit1710-Jul-06 12:07 
GeneralRe: HELP! Processor at 100% Pin
Not Active10-Jul-06 12:13
mentorNot Active10-Jul-06 12:13 
GeneralRe: HELP! Processor at 100% Pin
LongRange.Shooter11-Jul-06 9:02
LongRange.Shooter11-Jul-06 9:02 
Questionreturning more than one item Pin
Tom Wright10-Jul-06 10:58
Tom Wright10-Jul-06 10:58 
AnswerRe: returning more than one item Pin
Christian Graus10-Jul-06 11:06
protectorChristian Graus10-Jul-06 11:06 
AnswerRe: returning more than one item Pin
Aaron Dilliard11-Jul-06 4:09
Aaron Dilliard11-Jul-06 4:09 
Questiondisplay folder path in dialog text box Pin
x2pca10-Jul-06 9:41
x2pca10-Jul-06 9:41 
AnswerRe: display folder path in dialog text box Pin
Christian Graus10-Jul-06 9:52
protectorChristian Graus10-Jul-06 9:52 
GeneralRe: display folder path in dialog text box Pin
Jun Du10-Jul-06 10:05
Jun Du10-Jul-06 10:05 
QuestionRe: display folder path in dialog text box Pin
Nader Elshehabi10-Jul-06 13:49
Nader Elshehabi10-Jul-06 13:49 
AnswerRe: display folder path in dialog text box Pin
Jun Du10-Jul-06 15:32
Jun Du10-Jul-06 15:32 
JokeRe: display folder path in dialog text box Pin
Nader Elshehabi10-Jul-06 16:20
Nader Elshehabi10-Jul-06 16:20 
AnswerRe: display folder path in dialog text box Pin
Josh Smith10-Jul-06 10:37
Josh Smith10-Jul-06 10:37 
QuestionDataset copy Pin
Small Rat10-Jul-06 8:36
Small Rat10-Jul-06 8:36 
AnswerRe: Dataset copy Pin
Josh Smith10-Jul-06 8:40
Josh Smith10-Jul-06 8:40 
QuestionCalcBalance does not exist in the current context Pin
Skanless10-Jul-06 7:09
Skanless10-Jul-06 7:09 

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.