|
Yes!! PLease!!
_____________________________________________________
Believe! Every thing has a purpose
|
|
|
|
|
I need the two following functions rewritten to be recursive. It's from June's issue of MSDN Magazine, the article about a breadcumb/sitemap control for ASP.Net 1.1. I've translated into C#, but I'm not good with recursion (never have been), so any help would be greatly apprecited! Oh, and one other thing, the web.sitemap file that it reads from is 3 levels deep, these methods take advantage of that (<root><node><node2>), but as you could guess, the web.sitemap file could be infinately deep(that's what the recursiveness is for, as you know).
<br />
private SiteMapPath GetSiteMapPath()<br />
{<br />
SiteMapPath objPath = new SiteMapPath();<br />
SiteMapNode objCurrentNode = GetCurrentNode();<br />
SiteMapNode objTempNode = new SiteMapNode();<br />
int i = 0;<br />
bool found = false;<br />
<br />
objPath.Add(this.siteMapNode);<br />
<br />
if(objCurrentNode != this.siteMapNode)<br />
{<br />
while(!found)<br />
{<br />
objTempNode = this.siteMapNode.NodeList[i];<br />
if(objTempNode == objCurrentNode)<br />
{<br />
objPath.Add(objTempNode);<br />
found = true;<br />
}<br />
else<br />
{<br />
if(objTempNode.HasLeaf)<br />
{<br />
foreach(SiteMapNode objNode in objTempNode.NodeList)<br />
{<br />
if(objNode == objCurrentNode)<br />
{<br />
objPath.Add(objTempNode);<br />
objPath.Add(objNode);<br />
found = true;<br />
break;<br />
}<br />
}<br />
}<br />
}<br />
<br />
i += 1;<br />
}<br />
}<br />
<br />
return objPath;<br />
}<br />
<br />
private SiteMapNode GetCurrentNode()<br />
{<br />
SiteMapNode resultNode = new SiteMapNode();<br />
SiteMapNode tempNode = new SiteMapNode();<br />
int i = 0;<br />
bool found = false;<br />
<br />
if(this.siteMapNode.Url.Equals(this.currentUrl.PathAndQuery))<br />
resultNode = this.siteMapNode;<br />
else<br />
{<br />
while(!found)<br />
{<br />
tempNode = this.siteMapNode.NodeList[i];<br />
if(tempNode.Url.Equals(this.currentUrl.PathAndQuery))<br />
{<br />
resultNode = tempNode;<br />
found = true;<br />
}<br />
else<br />
{<br />
if(tempNode.HasLeaf)<br />
{<br />
foreach(SiteMapNode node in tempNode.NodeList)<br />
{<br />
if(node.Url.Equals(this.currentUrl.PathAndQuery))<br />
{<br />
resultNode = node;<br />
found = true;<br />
break;<br />
}<br />
}<br />
}<br />
}<br />
<br />
i += 1;<br />
}<br />
}<br />
<br />
return resultNode;<br />
}<br />
|
|
|
|
|
Recursion is not hard. It's simply a method calling itself, passing the argument necessary for the next loop (or acting on a reference object in the case of object-oriented platforms like .NET).
If you're having troubles and don't understand recursion (which you might want to read up on, since it's a pretty basic requirement of larger development efforts), take a look at some of the other breadcrumb controls for ASP.NET alread on this site:
http://www.codeproject.com/info/search.asp?&cats=3&cats=4&cats=5&cats=6&searchkw=breadcrumb[^]
Most even use recursion, IIRC, so you can get a good idea of how it works.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Does any body knows a NoteBook control like Delphi's control?
|
|
|
|
|
I've never seen Delphi, so what does a Notebook control do?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
A NoteBook control si like a TabControl without labels. Basicly, is a panel that allow to have multiple contents and change them dynamicly.
I have to develop an application outlook style, but left panel will be a container for many types of information. Each info has diferent
representation. SQL Server manager is an example.
Thanks
Elvis
PD: Sorry, my english is not good.
|
|
|
|
|
Hi,
I am trying to use OpenSchema method in C#. Here is my code:
res1 = m_Service.adoConnection.OpenSchema(ADODB.SchemaEnum.adSchemaTables, new object[] {null, null, null, "TABLE"}, null);
however, when the program is executed, the error below is returned:
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
May anyone teach me what is the correct syntax to use OpenSchema in C#? I cannot use OleDBConnection in this case as my code is to be used in both OleDB and ODBC connection.
Regards,
CTBMei
|
|
|
|
|
I define a class inherited UserControl like this
public class MyControlBase: System.Windows.Forms.UserControl
the default size of UserControl is width = 150 and height = 150
I set the new size
<br />
private void SetSize()<br />
{<br />
this.Size = new System.Drawing.Size(200, 200);<br />
}
then I draw a image at region Rectangle(150,150,50,50)
but nothing happend !
And if I put the same code in this procedure ,it working right
private void InitializeComponent()<br />
{<br />
this.Size = new System.Drawing.Size(200, 200);<br />
}
Why?
|
|
|
|
|
Did u call the SetSize() before InitializeComponent() is called in constructor?
|
|
|
|
|
You can't just draw on a control and expect it to persist. Once the control is invalidated (like when you resize it) you need to redraw.
So, override OnPaint :
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a application about drawimage. My form's have a backgroundimage.I want to display some images on it. And, these images need winking. but I don't know how to do it.
|
|
|
|
|
Uhhh.... "Winking" ??? What's that?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Do you know of a good source of info and/or examples for making a Internet Explorer plugin/viewer that displays a document type (like Acrobat Reader does) in .NET?
It would be nice to have information from someone who's done this sort of thing before, to save myself time, work, trouble, and mistakes.
I'm specifically looking for info specific to a C# implementation - the rest isn't that hard to find on MSDN and the Platform SDK.
Thanks!
|
|
|
|
|
|
By plugins, I assume you mean MIME handlers like Adobe Acrobat (/Reader)? For desk bands and BHOs, there are articles here on CodeProject where people have done it in C# (though that's a really bad idea since marshaling can slow the performance of IE and crash it, especially the way many people write code these days (no exception handling, simple checks, etc.)).
For a MIME handler, though, that's a different story. It's not something running continously. For that, see Asynchronous Pluggable Protocols[^]. You'd have to interop the interfaces and add a couple registration methods to register yourself as a MIME handler using the ComRegisterFunctionAttribute and ComUnregisterFunctionAttribute .
I started an async pluggable protocol library some time back but in my efforts to make it pretty abstract, I got sidetrack for real work at work and never got it finished. It is possible, though, I can tell you that.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I need to know how to change the BackColor of a TabControl object. I can change the BackColor of its tabs, but I am still left with the tabs set to the control color along with a control-colored line at the border of the TabControl. Is there some other way that this could be done? Any pointers would be greatly appreciated.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
I would like to be able to left click a button and see the context menu. The problem I am having is passing the button as the source control to display the context menu.
Any help on how to do this would be appreciated.
Stephen
|
|
|
|
|
Handle the click event of your button and in its method, insert something like (replacing btnMenuButton with the name of your button that you handled the click event of, and replacing mnuBtnContextMenu with the name of the context menu you wish to display):
Point pt = new Point(0, btnMenuButton.Size.Height);
mnuBtnContextMenu.Show(btnMenuButton, pt);
I hope this meets your needs.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
Hi ALL
Is it possible for me to develop a pocket pc Reversi online game using c#.net? What type of networking technique that I need to apply in my system. Thanks.
Jonathan
|
|
|
|
|
have a main form that my all tables filled in a dataset on that form.(i creat this DataSet visually , by drag and droping)
I create sum child forms that each one have a DataGrid object.
I want to set each DataGrid`s DataSource property to MainForm`s DataSet.
i want to do this action visually.(in other word, i want to set DataGrid`s DataSource property in PropertyGrid in each form.)
please guide to me.
|
|
|
|
|
One way is to pass the DataSource with constructor of your child forms to them. Another way is , I think accessing to main form from your child form with Parent property of your forms.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
thanks mazdak.
but i want to do it visually , not by code.
|
|
|
|
|
I don't think you can do it "visually". You'll have to do it through code, something like Mazdak says.
-Sheppe
|
|
|
|
|