|
I want to search trough a TreeView for a node with matching tag.
I have tried a recursive search. It works but I can't get the enumeration to break when the node is found.
My code:
private TreeNode SearchTreeNode(TreeNode node,string text)
{
foreach(TreeNode obj in node.Nodes)
{
if(obj.Text.Equals(text))
{
return (K3NodeObject)obj;
}
else
{
SearchTreeNode(obj,text);
}
}
return (K3NodeObject)node;
}
Can you give me some help or perhaps show me a better way to solve this?
|
|
|
|
|
Kalthoff wrote:
else
{
SearchTreeNode(obj,text);
}
How about:
else{<br />
return SearchTreeNode(obj, text);<br />
}<br />
Charlie
if(!curlies){ return; }
|
|
|
|
|
hi .. i have came to know that there is no help for sending a mms in .net .. so plzzzz if any one know any source code or any document plzzzzzz tell me ... (
|
|
|
|
|
I'm writing applications for the PocketPC 2003 using C# and .NET Compact Framework. One problem I encounter is when I use the Dialog.ShowDialog() command I end up with what appears to be two instances of my application. And of course if the user opens up a second dialog from the first one, now there appears to be three instances of my application. Where I see these instances is under Memory | Settings | Running Programs. Of course, if you select the wrong instance, you end up bring the wrong dialog in to focus and cannot do anything (because another dialog has the focus).
Does anyone know how to get around this problem? Am I using the wrong command, "Dialog.ShowDialog()"??? Any help would be grately appreciated.
-EZ
"I don't know about you, but nobody ever issued me an instruction manual; I'm just muddling along as best I can, knowing I'm never going to get out of it alive but trying not to $@#& up to badly in the mean time" - Stephen King
|
|
|
|
|
Ensure that the the form that defines you dialog has the Text property (the title of the dialog) different from that of the application. Then at least they will show up differently in the Memory control panel applet.
--Colin Mackay--
|
|
|
|
|
Hi all,
I'm having a problem with unhandled exceptions in a winform user control.
In the main.cs I have:
[STAThread]
static void Main()
{
System.Threading.Thread.CurrentThread.ApartmentState = System.Threading.ApartmentState.STA;
AWSWndExceptionHandler eh = new AWSWndExceptionHandler();
Application.ThreadException += new ThreadExceptionEventHandler(eh.OnHandleException);
Application.Run(new frmMain());
}
where 'AWSWndExceptionHandler' is my internal class for exception handling.
Then I includ in the form a custom control 'GridCalendar' having a dragdrop functionality. Everything works fine a part from unhandled exceptions thrown in GridCalendar_DragDrop and GridCalendar_DragOver events...they get 'eaten' somewhere and I don't see them...
For example the if I have following DragDrop event:
private void GridCalendar_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
throw new ApplicationException("test drag-drop"); //testexc
}
when I drag and drop an item on the control, the expection 'testexc' is thrown but not bubbled up to the stack, so I don't get any error...the item is not dropped on the control, the form does not crash but the user doesn't know what's wrong...
Any idea what I'm doing wrong?
thanks
Stefano
|
|
|
|
|
I've read Heath's excellent article on using encrypted XML for licensing a product, and will probably do this for one I'm about to release, as I really only want to deter unlicensed users, rather than make everybody's life difficult.
Before I do though, doe anybody know of any off-the-shelf licensing solutions that might be viable for a one-man ISV like me, and wouldn't take a load of time to code up & manage?
Cheers,
Rich
|
|
|
|
|
Dear friends:
My team has the following task to complete.A solution that consists of 3 projects :
1-Win app that connected to a local DB server(SQL server) .
1-Web app that connected to a remotre server(SQL server).
1-Mobile app for that connected to tha same remote server of the web app.
The Details:
1-The win app deals with a DB(Local DB SQL server) for updating ,retriving,inserting and deleting.
2-The web & the mobile app deal with a DB(Remote DB SQL server) for tha same purpose.(updating ,retriving,inserting and deleting)
The Goal:
1-The Win app will connect one time per day to update the Remote SQL server with the new data from the Local SQL server.
2-The Web and mobile app connected to the Remote SQL server will update ,retrieve ,delete and insert records in it.
The Questions:
1-If I can use Asp.net web services ,How can I use it?
2-How can i make daily transaction to update the Remote SQL server with the new data at the Local SQL server??
3-How can i make daily transaction to update the Local SQL server with the new data at Remote SQL server ??
4-How can i manage the DB Transactions ?
5-how can i use the same methods(code) for dealing with the DB ,for the win app , the web app and the mobile app?
5-What is the best way to complete this solution?
Thanks for reading to this line.
I hope you can help me.
thanks again.
Best Regards
Ahmed Gaser
FCSIS
IS Dept.
|
|
|
|
|
I'm having some trouble with a ListView control
that i have placed inside a panel.
Now this panel has scrollbars, so when i click the listBox control this will bring it into view (if it is, for example, only partly into view), but I REALLY don't want this behaviour. I want the scroll to stay where it is.
Is it possible to get rid of it by overriding / setting flags / other way?
grateful for some help!
|
|
|
|
|
Hello !
Coming from the delphi world, I'm trying to do the same using .NET as a TStringGrid could act.
Explanation :
my issue is that I want to drop a grid (datagrid,...) that is not linked directly to a dataset and that I paint cell by cell depending on the values of an array for example. This painting is for the main part a change of the background color of the considered cell and the drawing of a string in it.
Need I a dataset nevertheless ? which I fill with my values and link to the grid ?
How to draw a grid cell by cell ? Must I use the OnPaint event and cycle through cols and rows ?
Thank you in advance for your attention and help, and for all of your tips !
Guim7
-- Trying to sink deep inside .NET Framework, glups ! --
|
|
|
|
|
Hi Guim,
All you need to do is set the grid's DataSource to your array. The DataSource does not have to be a DataSet, you can bind to any type of object implementing the IList or IEnumerable interfaces (which includes Arrays).
Hope that helps!
Datagrid Girl
|
|
|
|
|
Hello DGGirl !
Thank you very much for your answer, it makes me happy to see I'm not let alone on this wide planet...
What you wrote is true and I did know that !
My very issue is in the custom painting of the datagrid, that is to say I would want to customize the display of all my cells separatly.
For example, all the cells that are on the first line and that have the A value will have a blue background and their text will be drawn in the top left hand corner, but the ones which are on column 3 and that are linked with a null data struct (null array item for example) will contain a red italic text on a black background.
PLEASE DON'T SLEEP !!!
I don't know if I'm clear enough but I try, I swear !...
Could someone help me to render my datagrid in a customized way ?
Thanks a lot in advance for all clue I would receive...
Guim7.
- Deeper and deeper in the abyss-
|
|
|
|
|
Sorry, I nodded off there for a second, what were you saying?
I'm assuming that you are talking about the Windows/WinForms Datagrid, rather than the ASP.NET one? (The formatting techniques for each are very different).
For Windows, you can override the Paint event, and there is a FAQ on this page that explains the process in a bit more detail: http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q745q
Hope it helps--you are not alone!
Datagrid Girl
|
|
|
|
|
Thank you very much for all!!!
You're the best in the world on datagrid handling !
I'm trying this stuff right now !!
Have a nice day!
bye,
Guim
|
|
|
|
|
Is it possible to access the current memory usage values for the running application, from within the applications own code? I have had a hard time finding documentation on this. At first I tried to use the performance monitor classes, but I can't see a way to load up a performance monitor for the current process. Is this possible in .NET? I appreciate any replies.
|
|
|
|
|
long memUsed = System.GC.GetTotalMemory(true/false);
True if you want to force a garbage collection before computing the memory used.
|
|
|
|
|
Hmm...I was looking for a finer grained level of detail....the kind of info you can get from perfmon. Physical and Virtual memory usage, garbage collection counts, propmotions, etc.
|
|
|
|
|
Does http://www.aspheute.com/english/20000809.asp help?
|
|
|
|
|
Well, not really. I know how performance counters work, how to create them, etc. etc. My question is how to I get a performance counter, in say the .NET GC category, for the "current", that beeing the key word, process. The process that I'm actually instantiating the performance counter from? This is not a web application, its a windows forms application. I'm not trying to recreate the perfmon application, I don't want to view performance counters for "other" processes....I want to view them for the process from which I instantiate the counter.
I've looked and looked, but there doesn't seem to be a site on the net or a single word in the .NET documentation that says how to get a counter for the current app, the one that instantiates the performance counter itself. The current instance is what I'm inclined to call it, but there doesn't seem to BE a current instance, only global instances and specific instances for some apps.
|
|
|
|
|
I'm considering migrating to Visual C# and expanding my skills. But is it worth it considering many of the things I need to do can be done using Managed C++. Also in MC++ it is possible to continue to use the STL.
What can be done in C# that can't be in MC++, are their any distinct advantages, apart from nicer syntax and more companies seem to want c# programmers than MC++?
Or is it best to create an appliction using C# and then use MC++ to create components that use the STL and other C++ only features? What i'm really getting at, is it worth gettin Visual C# instead of continuing to use Managed C++ in Visual C++ .Net 2003?
Thanks for your time.
P.S. If anyone knows of a company in the UK requiring or desiring a recent graduate with a 2:1 in Computing, please let me know
|
|
|
|
|
There are a few things I miss from C++ (like templates, const functions/parameters) when I migrated to C#, but there are a number of things that I like about C# (like not having to worry so much about forgetting delete and the resulting memory leaks)
From a marketing perspective (i.e. Marketing your skills to prospecive employers) C# is on the increase and would definitely be an advantage.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
if you use managed objects in c++ though, you still don't have to remember to use delete, as it's handled by the Garbage Collector. Though skills wise it is probably worth it.
|
|
|
|
|
A well renound hecker remarked "C# is C+-". And according to my experience he is very true. The way U can write blazing fast,flexible code in C++, is a distant dream in C#. Professionaly, development time in C# is less, because of boiler plate codes,hence it is in demand. But it still has to go a long way to reach the penetration what C++ enjoys.
Cheers!!
Siddharth
|
|
|
|
|
Depends on the amount of the complexity of programs and the amount of knoweledge you have.
Here is a little picture:
Knowledge to do Visual Basic (6) CSharp (Or Java) C++
Simple work Very Few Some Lots
Medium work Lots Lots Lots
Complex work Forget it Very Much Lots
Chooses depending on the amount of time you want to invest, or the kind of application you will build up.
|
|
|
|
|
I'm trying to provide simple "pop-up" (e.g., tooltip-style) help hints for my dialog controls (standard Windows Forms using C#), using System.Windows.Forms.HelpProvider and System.Windows.Forms.Form.HelpButton. I'm using only the "SetHelpString()" method on the HelpProvider to set the help text to strings managed internally by the application.
When I invoke the help the first time, it always seems to work. Sufficient subsequent invocations invariably either crash the program completely (with an "Application Error" dialog:
The instruction at "xxxxx" referenced memory at "xxxxx".
The memory could not be "written". Click on OK to terminate
the program
- sometimes it says "read" instead of "written") or cause some very strange application error/exception that the CLR does manage to catch.
Does anyone recognize this? Is there a fix for it? I've searched MSDN Knowledge Base and Google (and here at CodeProject) for clues, but nothing comes up.
Help!!
Here's a program that demonstrates this problem for me, usually within 5-10 usages of the "HelpButton":
-----------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.HelpProvider helpProvider1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
string s= "This is the help for button 1 I hope it is long and helps us to figure out where the problem is" ;
helpProvider1.SetHelpString(button1, s) ;
s= "This is the help for button 2 I hope it is long and helps us to figure out where the problem is" ;
helpProvider1.SetHelpString(button2, s) ;
s= "And this help is for the text box" ;
helpProvider1.SetHelpString(textBox1, s) ;
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.helpProvider1 = new System.Windows.Forms.HelpProvider();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.Location = new System.Drawing.Point(184, 16);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "Cancel";
//
// button2
//
this.button2.Location = new System.Drawing.Point(184, 56);
this.button2.Name = "button2";
this.button2.TabIndex = 2;
this.button2.Text = "button2";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(24, 24);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 3;
this.textBox1.Text = "textBox1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(288, 122);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.textBox1,
this.button2,
this.button1});
this.HelpButton = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
|
|
|
|