|
First of all, hi to everybody, it´s my first post And sorry for my english I am from Spain.
Well I am making a little app that write questions with their answers into an xml file. I am using a treeview to display the data.
The question is the top node, and in it there are subnodes each for an answer.
I know how to see which node was selected with this code:
<br />
if(this.IsNode(tree.GetNodeAt(this.tree.PointToClient(Cursor.Position)))==true)<br />
Where IsNode is:
<br />
private bool IsNode(TreeNode node)<br />
{<br />
try<br />
{<br />
string foo = node.Text;<br />
return true;<br />
}<br />
catch<br />
{<br />
return false;<br />
}<br />
}<br />
My question is:
How can I see if an subnode is selected or an node? I want to show an menu for answers and another for question.
Thanks a lot
|
|
|
|
|
You are doing it the hard way.
There is an easier way to get what you want, by using the TreeView.SelectedNode [^] property. This property returns the currently selected TreeNode , or null if no node is selected.
Now you can test whether the returned TreeNode is a subnode. Remember that a root node doesn't have a Parent node, so we test that:
public bool IsSubnodeSelected()
{
TreeNode selected = MyTreeView.SelectedNode;
if (selected != null)
{
if (selected.Parent != null)
return true;
}
return false;
}
The above method would return true if a subnode is selected, and false when a rootnode or no node is selected.
- Daniël Pelsmaeker
|
|
|
|
|
Thanks a lot, it works but SelectedNode doesn´t work with right click so I use:
<br />
private bool IsSubNode()<br />
{<br />
TreeNode selected =treeview.GetNodeAt(this.treeview.PointToClient(Cursor.Position));<br />
if (selected != null) <br />
{<br />
if (selected.Parent != null)<br />
return true;<br />
}<br />
return false;<br />
}<br />
GetNoteAt with Current Mouse Position works with right click, now subnode works, and I can follow with my little app, thank you
|
|
|
|
|
hi i need any function helping me to create new dial-up connection on pc
|
|
|
|
|
Do you mean a new connection that they can choose from the auto-dial screen, or just a connection to their ISP? For the latter, see the WinINet[^] documentation.
For the former, this really seems to be platform-dependent, i.e. Windows XP works a little differently from Win2K, which works a lot differently from Windows OS's like 98 and ME. If you use the information above, specify functions like InternetAutodial , the user could create their own connection. If you need to create it for them (like some ISP do with their auto-configuration), I think you can do this with .cnf files.
One more way is to use the function InternetDial , which allows you to specify a connection name, flags, and a number to dial. This way, at least, you could get them to dial a particular server. An HWND the parent window (Form.Handle , inherited from Control.Handle ) is required for the prompt dialog. This is supported in all Windows platforms that support .NET.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hello,
how can I send parameters to a designed page ( smart doc )?
thanx
anat
|
|
|
|
|
Hello,
I want to create an option dialog like Microsoft visual C# .Net option dialog
which consists of a tree in left panel and a by clicking on its node
left panel changes.
Is there any template or sample code that I can use it.
Thanks & Regards
Saeideh
|
|
|
|
|
I would create a form, then put a TreeView on it. Set it's Dock property to Left . Then create multiple Panel objects with different names (or create them in your form code in an array). Then, when a specific TreeNode is selected (check in the Click event), you show a specific Panel, and hide the others. You may want to set the Panel 's Dock property to Full .
- Daniël Pelsmaeker
|
|
|
|
|
You should also try searching CP for option dialogs. There are several examples that work the way you want.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi Guys!
we know that there is a way to handle custom exceptions in
asp dot net by specify the error page.
is there any way to do the same in csharp windows form.
i.e custom windows form.
i don't want to write try/catch block in my programm
in all places.i just want to write it once where it can handle all the program exception. is there a way.
Ali Khan
|
|
|
|
|
Legend Never Dies wrote:
is there any way to do the same in csharp windows form.
No. You can't get exceptions without try/catch,I think the best you can do is use try/catch and popup your custom error form in catch part.
Mazy
No sig. available now.
|
|
|
|
|
No u don't understand my question,
i want to write only one try/catch block that can handle all the exceptions of the whole applications, which off-course may contains multiple windows forms
|
|
|
|
|
Handle the HttpApplication.Error event in your Global.asax file, or it's related code-behind file. Since auto-event-writeup is enabled by default, you can just declare your handler as
private void Application_Error(object sender, EventArgs e)
{
HttpServerUtility server = HttpContext.Current.Server
Exception e = server.GetLastError();
} For more information, see the documentation for the event I mentioned, and the HttpServerUtility.GetLastError method.
You could also create your own IHttpModule for handling, errors, too, if you require library portability without moving the whole web application.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
There are some buttons in yahoo and hotmail that have fletcher at the left or right of them and when you click on them drop down menu appear and you choose an option. I need them in my windows applicaation in C#.Does anybody know them? I don't have time to develop them myself.
Mazy
No sig. available now.
|
|
|
|
|
You might get an idè by studding the source code for
http://www.codeproject.com/cs/miscctrl/color_picker.asp?target=color%7Cpicker
Thomas
|
|
|
|
|
Hi,
I was just wondering...
how do you make a stand-alone program in Visual C#.net 2003 that can be used by people who do not own visual studio, or any programming language for that matter.
Currently it says that they're missing MSCOREE.dll, and I suspect they're missing about 40 other dlls as well.
Any ideas?
Thanks
|
|
|
|
|
Hi,
The user that executes the program, gotta have the dotNet 1.1 Framework.. =)
..?
// Up The Irons, SirErugor
|
|
|
|
|
It's called the dot net framework. You kind of have to install it on the client computer.
|
|
|
|
|
I already said tha'
// - Up The Irons, SirErugor
|
|
|
|
|
Lord Tor wrote:
how do you make a stand-alone program in Visual C#.net 2003 that can be used by people who do not own visual studio, or any programming language for that matter
[Key points in bold]
There needs to be a distinction in your mind between the framework, the language, the compiler, and the development environment. * The language is the syntax, grammar, and conventions that define how the code is written and interpereted. The compiler turns the code given to it into an executable file or library (called an assembly in the .NET world). The development environment is the application you use to help you create programming projects.
A framework (loosely defined) is a core library that you use to build your applications. ** The .NET framework happens to be an integral part of the C# language - it doesn't function without it. Because of this, the .NET framework must be installed for your applications to run. The .NET framework is a free redistributable, and should not be confused with VS.NET, which is MS's development environment for .NET, and which costs a fortune.
Sorry for being a bit long-winded, but I just wanted to make sure things are clear for you.
* You may already know some of this, but just in case...
** OK, I can just see myself being corrected by the "purists". FYI, I have read Marc Clifton's "What is a Framework?".
|
|
|
|
|
Thank you all for your help. So telling my users to download the .net framework 1.1 is the only thing I need to do? It's not like C++.net, requiring you to statically link your program?
Cheers
Mike
|
|
|
|
|
I have a ASP.Net Web Application project and I have multiples web forms. How do I activate or load a new web form into my current browser window. The method
Form frm = new Form();
frm.ShowDialog();
doesn't work here because this is not a window application. Here we don't have this method available.
I appreciate any help.
The rookie
|
|
|
|
|
As this is an ASP.NET related question perhaps you would like to ask it int the correct forum.
|
|
|
|
|
There are two methods for doing this:
Server.Transfer("yourpagename.aspx");
or
Response.Redirect("yourpagename.aspx");
Hope this helps!
|
|
|
|
|
What is that application that generates *.chm file automatically based on a dll?
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|