|
The "current node" is not the node that I am right clicking on to bring up the popup menu.
The menu handler looks like this:
private void mnuAddElement_Click(object sender, System.EventArgs e)
{
TreeNode tn=tvSchema.SelectedNode;
tn.Nodes.Add(new TreeNode("Element"));
tn.Expand();
}
And the node is correctly highlighted, but after adding the new node the highlight reverts back to whatever node was selected using a left click.
What do I do about this? I want it to work like it should--right clicking operates on the node that the user clicked on, not the last left-clicked node.
Help!
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator. Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus Every line of code is a liability - Taka Muraoka
|
|
|
|
|
|
Thanks!
Almost works. The mouse position by this point is over the item the user clicked in the popup menu.
You led me down the correct path though, which is to write a mouse down event handler:
private void EventMouseDown(object sender, MouseEventArgs e)
{
tn=tvSchema.GetNodeAt(e.X, e.Y);
}
and save the node the user clicked on.
Note that it has to be a mouse down event. I tried mouse up, but that doesn't fire until the popup menu is done, and thus the mouse position is again wrong.
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator. Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus Every line of code is a liability - Taka Muraoka
|
|
|
|
|
I've got a Windows Forms application (C#) and I have several cursors that I've drawn which I want to be able to embed in the application. I am able to load the cursors from a file, but not as an embedded resource.
Can anyone give me some pointers about how this is accomplished? I am using VisualStudio.Net.
Thanks.
|
|
|
|
|
Ok, this is going to be a little off-topic, but its a .NET Architectural-type question.
I'm working on the architecture to my University final year project, which is based around a commercial XML Web Service providing access to high performance analytics (courtesy of a third-party database).
However, it will also need to perform a number of menial housekeeping work too -- providing audit trails, reporting etc. It would be useful to have some kind of application that can effectively monitor the web-service too, i.e. current load that kind of thing.
I am considering using the following design:
ASP.NET Web Service <----> Windows Service <-----> Databases
With the Windows Service providing access to all the gubbins that hooks the web service together. That way, an administrative application can then access the windows service to get at the reporting info.
Does anyone have any opinions, or suggestions as to how this kind of thing might be done?
Alternatively I'd thought about adding filters using Microsoft's recently released Web Services Enhancements pack. Adding filters for logging requests etc.
All opinions would be greatly received,
--
Paul
"If you can keep your head when all around you have lost theirs, then you probably haven't understood the seriousness of the situation."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
Hi Paul,
Having this pipeline from Web Service -> Windows Service -> Database and back forces you to write (and debug) a lot of soap and remoting stuff (from outside to the WebSvc and back, from the ASP.NET Web Service to the Windows Service (remoting) and vice versa.
Consider the following approach:
Windows UI/Console client [*remoted]
|
Windows Service
|
v
Internet <---> ASP.NET <--> Busines Logic DLL <--> Database
^
|
Windows UI/Console client [*simple]
This way you can concentrate on core functionality by developing the Busines Logic Class Library and add all kinds of connectivity afterwards.
greetings,
Gertjan Schuurmans
Amsterdam
The Netherlands
|
|
|
|
|
I'd like a "BetaExpiration" attribute (DECLARITIVE security) on my classes that is enforced automatically when the assembly containing the classes is used. A security exception should be thrown if the classes are being used outside beta period.
[AllowedUse(From = "2003-1-30")]
public class x
{
public x()
{}
}
CodeAccessSecurity permission is the way to do it and I've already got an test implementation. The major problem is that my custom CodeAccessSecurity derived permission assembly should be registered on the user's machine using CasPol etc for the .Net security system to find and use it. This is not desirable. The app should just be installed and my custom codesecurity access should be enforced...
Another way is implement another custom permissing, implement IPermission, ISecurityEncodable. Unfortunately, the declarative notation is never instantiated, unless I do it myself in code; the imparative method is working fine, but I'd like to use attributes for this!
public x()
{
AllowedUse2 au = new AllowedUse2();
au.From = "2003-1-30";
au.Demand();
}
Does anyone have a bright idea how to enforce custom CodeAccessSecurity using declarative notation without requiring .Net registration of the permission assembly?
Victor
|
|
|
|
|
Never mind, I thought of a solution.
VictorV
|
|
|
|
|
On many newsgroups/forums have I repeatedly seen the question: "How do I bind a TreeView to a datasource?" Now, I'm attempting to create a DataTreeView by inheriting from TreeView and providing complex data-binding, but have run into many design issues. I have seen several solutions, such as the ones here:
http://msdn.microsoft.com/library/en-us/dnwinforms/html/custcntrlsamp3.asp#custcntrlsamp3_download
http://www.abderaware.com/WhitePapers/datatreeview.htm
However, the problem with all these solutions (and many other things .NET) is their exclusive focus on DataSets. I'm trying to create a more versatile control that can additionally support actual tree structures, lists of lists, or any other class.
One solution I considered - specifying a DisplayMember/ValueMember/ChildCollectionMember for the control - limits you to using a single type throughout the entire tree (or at least all types with the same display/value/children property names).
Another solution requires ITreeNode and ITreeNodeCollection interfaces to be implemented by the data source. For existing classes like the DataSet, this means either re-implementation or ITreeNode/Collection "adapter" classes. This is the best I've come up with, but I'm wondering if anybody can provide me with some more insight and/or has already done this (since a databound TreeView is one of the more sought-after controls). Or better yet, have an article that discusses how to accomplish this on the site.
What? Were you expecting something witty or funny here?
|
|
|
|
|
Hi all, I was wondering if anyone out there had tried using .NET objects from a pre-.NET scripting environment (I want to use Windows Script hosted JScript). I'm sure it is possible through COM interop, but can anyone tell me of an article or web page to get this running quickly and easily?
Thanks for any suggestions,
Nick
|
|
|
|
|
You can call a .NET component from the outside world. That's done through CCW, COM Callable wrapper, which is by the way the keyword to use to find articles on Cp, MSDN, ...
The procedure is as follows :
- write a component using C#, or whatever .NET language you can think of
- register the component to the unmanaged world using the regasm.exe cmdline. Doing so, this component looks like a standard COM component, except the fact that the InProcServer32/LocalServer32 registry key points to mscoree.dll instead (that's the CLR entry point).
- use JScript to create an instance of this object. Here is how you create COM instances :
var ExcelSheet;
ExcelApp = new ActiveXObject("Excel.Application");
ExcelSheet = new ActiveXObject("Excel.Sheet");
ExcelSheet.Application.Visible = true;
ExcelSheet.ActiveSheet.Cells(1,1).Value = "This is column A, row 1";
ExcelSheet.SaveAs("C:\\TEST.XLS");
ExcelSheet.Application.Quit();
A useful link[^] on MSDN.
|
|
|
|
|
Thanks, I looked around for a while but unless you know a couple of 'magic keywords' like CCW its pretty hard to search for anything containing .NET and JScript. Thanks again, there are a world of cool possibilities for this stuff
|
|
|
|
|
Does anyone know if there are .Net file exists/delete methods that will handle wildcards? File.Exist and File.Delete do not. Thankyou!!
Lorne
|
|
|
|
|
|
Hello,
I've got a C# windows app and I'd like to keep the resources in a centralized place so I've added a resx file to my project where I store all my english strings. This is I guess what they call an embedded resource. My question is, can I add another resx file to hold my german strings and embed it into the same assembly? If so, can anyone pls outline how to do that?
Thanks in advance. Any help is highly appreceated.
Matthias
In theory, there is no difference between theory and practice. In practice, however, there is.
(unknown author)
|
|
|
|
|
Matthias Steinbart wrote:
embed it into the same assembly
Although it's probably doable, I don't recommend it. It's part of the usefulness of assemblies to have a culture attached to them (AssemblyInfo.cs file). Typically you provide an assembly for each supported culture, and doing so the run-time automatically loads the appropriate assembly. This saves you time, effort, plumbering, and... bugs.
|
|
|
|
|
Hi all,
What is the easiest way to tell if a computer has the .NET Framework installed? The more non-technical the better. Is it the same for each OS or are there different methods?
Thanks in advance
Andy
|
|
|
|
|
presence of <winsysdir>mscoree.dll (the entry point of the CLR).
Also read the registry to check out the current version (HKLM\Software\Microsoft\.NETframework).
|
|
|
|
|
Hi ,
I can't run ASP.NET Applications or SOAP apps on my PC.
I have WIN2K PRO SP3 w/ IIS installed ..
Here is the error msg I get when i run my apps ..
Compiler Error Message: CS0013: Unexpected error writing metadata to file 'C:\WINNT\Microsoft.NET\Framework\v1.0.3705\Temporary ASP.NET Files\webapplication2222\df162b42\f1bc067\tvjmw6ty.dll' -- 'The directory name is invalid. '
( It looks like a file not a directory name .. ) .. ??
ANYONE ???
|
|
|
|
|
See if you have both C: free diskspace and if the ASPNET user have writing rights on the specified folder.
Other thing you could try is see if the directory C:\WINNT\Microsoft.NET\Framework\v1.0.3705\Temporary ASP.NET Files exists.
The 3rd thing to try is running C:\WINNT\Microsoft.NET\Framework\v1.0.3705\aspnet_regiis.exe
The last thing to try is suicide
I see dumb people
|
|
|
|
|
Tried all those things: nothing worked.
Even tried re-install .NET/VS.NET ..Didn't work..
Re-install IIS .. didn't work ..
Any other ideas ???
I'm wondering if its because my system is UP TO DATE ..
mmmmmm
|
|
|
|
|
I got it fixed... Even a re-install won't fix it..
What you have to do is go to control Panel, Select Add/Remove Programs and when the .NET screen comes up select REPAIR and that will work. Apparently it forces the regirstration of some DLLs or something ..
But it is funny that a re-install doesn't work ..
hehe .
thks .
Dato .
|
|
|
|
|
Hi,
I have installed .NET Beta 2, version v.1.0.2914 on my computer.
Trying to UnInstall the .Net raises an error "Setup cannot read/write to System Registry".
I want to install an SDK framework and I need to uninstal first the above but cannot.
Can you help me here?
Thanks
|
|
|
|
|
garfild wrote:
I have installed .NET Beta 2, version v.1.0.2914 on my computer.
Trying to UnInstall the .Net raises an error "Setup cannot read/write to System Registry".
I want to install an SDK framework and I need to uninstal first the above but cannot.
Can you help me here?
We had a problem at work with either beta 1 or 2, I can't remember. It was just on a test machine so we wiped it clean and did the re-install.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
I have only been looking at the articles posted for .NET for a short time. There are some very usefull articles and complete components. Does anyone have any comments or thoughts on starting a CodeProject namespace and bringing together the code into one place? This would reduce the possible duplication and help developers using the code........
Am I barking up the wrong tree?
|
|
|
|