|
?????????????????
lost my way
|
|
|
|
|
Hi,
this is my first posting to this message board... i hope you can help me and i can help you in further questions:
is it possible to create an indexer that is defined as followed:
public String this[Object NestedObject]
is it possible to define a Indexer that is defined as followed:
public String NestedObjects[Object NestedObject]
so that i can access as followed:
Object.NestedObjects[Object2];
is that possible in C# or not possible. As i need to access in that way to nested objects, which are defined in the object as an array:
Object [] NestedObjects = {};
thx in advance
littleguru
________
love your code and code your love
|
|
|
|
|
I have an application that creates a Mutex before calling Application.Run. With a call of Mutex.WaitOne(1, True) I check to see if it is blocking. If it is blocked that means there is another instance of the application already running so I exit, and if it is not blocked then I continue executing the application.
The debug build works as expected: the first call to my executable loads and displays the MainForm with subsequent calls to the executable quiting after realizing it is blocked. However, the release build does not work correctly. Subsequent runs of th executable do not get block, and I end up with multiple instances of the application running simulataneously.
I have no DEBUG conditional or specified code. With some testing I was able to figure out that if I turned off compiler optimizations and turned on the generation of debugging information, the release mode would work as expected.
Anyone know what could be causing this strange bahavior? Do Mutexes behave differently under different project configuration properties?
Thanks for any help or ideas.
|
|
|
|
|
I figured out some more details of what's going on. It is still a mystery to me.
My application actually does more than just shutdown when it finds out that there is another instance of the application running. It notifies the first instance that there was an attempt to open another instance. It does so by using Remoting, marshalling a communicator object using a TcpChannel.
When the first instance starts it begins by creating a Mutex, it then creates the communicator object, publishes it to a Uri, creates a TcpChannel, and registers the TcpChannel. The Mutex suceeds in blocking all subsequent instances up until the point it creates the TcpChannel. The thread should still own the Mutex since I neither removed the Mutex nor exited the thread. The funny thing is that when debug information is included and compiler optimization is turned off, the Mutex blocks until the first instance is closed...
The line that creates the TcpChannel, and which seems to be causing the problems with the Mutex is as follows:
TcpChannel tcp = New TcpChannel(props, null, null);
where props is justa hastable with bindTo=127.0.0.1 and port=0.
Any ideas?
|
|
|
|
|
|
That is what I based my code on. The code dealing with the mutexes is pretty much identical, my program really only differs in how it responds to subsequent launches of the application.
I was able to get it working in the Realase version of the application by adding a fix. I recreate the Mutex right after I create the TcpChannel that causes the program to lose the Mutex for some reason. I have no idea what is going on, but it works now, so that's nice. I would still like to do it without this fix if possible, if anyone has so idea.
|
|
|
|
|
I am using Charles Petzold's "Programming Microsoft Windows with C#" to learn Windows Forms programming. Unfortunately, it does not include using the IDE. I have modified one of his examples of a tree to include several panels and various controls to test the class member functions. I have also added controls with the IDE. A couple of times, my hard work of listing the Nodes for the tree has disappeared as I use the IDE to add components, modify the size of the panels, etc. I have gotten a little smarter and included the node-code in a separate "populateTree()" method. The typing is saved, but the call to the function disappeared on me once.
How can I avoid this. Is this happening because I put the code in the "InitiateComponents()" method?
When you come to a fork in the road, take it! Y. Berra
|
|
|
|
|
That's a known bug of VS.NET 1.0. Hopefully, this will be fixed in next release.
In the mean time, don't hesitate to add the using System.Windows.Forms.TreeView; statement. And don't hesitate to use a fully qualified method name, instead of a short name (assuming the using xxx; provides the compiler with the missing path).
In fact, the mess occurs when you switch from the code to the designer view. The designer view takes the opportunity at this very moment to rebuild the Form from scratch and, because there's that tiny bug, it may decide on his own there's no more treectrl. And it removes it. Either the tree ctrl disappears from the designer view, or methods disappear, etc.
By using more explicit namespaces, as I have said earlier, I have never got this problem back again.
Good luck then!;P
How low can you go ? (MS rant)
|
|
|
|
|
Donald Blachly wrote:
Is this happening because I put the code in the "InitiateComponents()" method?
Yes, never ever ever ever ever put code in the InitializeComponent() method. (There is a reason there is a comment saying "Required method for Designer support - do not modify the contents of this method with the code editor." Its because the forms designer places all of its initialization code in that method re-writing it when major/minor changes occur.)
IIRC, this is part of the reason Petzold didn't use the IDE for the book; the code generated by the designer isn't the prettiest.
Instead put your code after the InitializeComponent() call in the constructor or override the OnLoad method or attach a handler to the Load event.
James
Sig code stolen from David Wulff
|
|
|
|
|
Thanks for both the above comments.
/don
I will not put code in the InitializeComponent() method!
I will not put code in the InitializeComponent() method!
I will not put code in the InitializeComponent() method!
I will not put code in the InitializeComponent() method!
I will not put code in the InitializeComponent() method!
|
|
|
|
|
Donald Blachly wrote:
I will not put code in the InitializeComponent() method!
James
Sig code stolen from David Wulff
|
|
|
|
|
James T. Johnson wrote:
Yes, never ever ever ever ever put code in the InitializeComponent() method
Hmmm, I have a habit of doing just that, especially if InitializeComponent isn't collapsed.
So far I haven't been bitten. But I remember, Delphi used to make designer generated code uneditable by default. I always thought that was a good idea.
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
I was wondering how to tell a Validation Control to perform validation only when the next button of a form is pressed and not perform validation when previous button is pressed/
Also, I was wondering how you can retrieve IP address information of users hitting your site in C#?
thanks
|
|
|
|
|
This should really go in the ASP.NET forum...
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
|
|
|
|
|
Anonymous wrote:
I was wondering how to tell a Validation Control to perform validation only when the next button of a form is pressed and not perform validation when previous button is pressed
well, if you name your next button submit, and the previous button submit, then you can check to see which of the two where pressed, by checking the value of the submit argument sent to the page, it would have a value of the text on the button pressed. I think that should work, but i dont know how to retrieve the variable information.
Anonymous wrote:
Also, I was wondering how you can retrieve IP address information of users hitting your site in C#?
cant help you here, but in php you can just duse the $REMOTE_ADDR variable. at david stone.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Hey you're back! How was the trip?
Nnamdi Onyeyiri wrote:
but in php you can just duse the $REMOTE_ADDR variable. at david stone.
But in ASP.NET you can just use Request.ServerVariables and then you use the $REMOTE_ADDR stuff just the same... So 2 at you.
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
|
|
|
|
|
David Stone wrote:
Hey you're back! How was the trip?
OK, got a little boring, it was more of a look at your inheritance trip than a holiday.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Anonymous wrote:
I was wondering how to tell a Validation Control to perform validation only when the next button of a form is pressed and not perform validation when previous button is pressed/
Set CausesValidation to false on the Previous button.
Anonymous wrote:
Also, I was wondering how you can retrieve IP address information of users hitting your site in C#?
Request.UserHostAddress
Paul
I think there're pieces of me you've never seen - Tori Amos, Tear in Your Hand
|
|
|
|
|
how to list all the PCs within a group using Active Directory??
|
|
|
|
|
I think you can start from here:
http://www.codeproject.com/csharp/ServerComboBox.asp[^]
It use NetServerEnum function.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
I know that it's somewhere within the System.DirectoryServices namespace...
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
|
|
|
|
|
Hi,
I just installed the Visual Studio .Net (Chinese Version) under
Japanese windows 2000. There are no problems for load/open a solution or
project and complie and run the projects. But the problems occurs when
i create a new project or solution. After new project, set the type of the application and set the path, and then "OK", I got an error:
"Microsoft JScript Compile error".
Would you please tell me what is my mistake?
Thanks in advance!
chen
|
|
|
|
|
May be your security level (Internet settings) is too high and you don't allow javascript to execute.
Other than that, I believe this is not a programming question, and would suggest you to post either on a public MS VS.NET NG (likely to get an answer), or even http://support.microsoft.com
How low can you go ? (MS rant)
|
|
|
|
|
Hi, Rod,
Thank you very much for your reply!
I reall want to know how to check the "security level" and make it low?
Best Regards,
chen
|
|
|
|
|
In the Windows control panel, double-click the Internet Options icon. Then, in the security tab, click the "Local Intranet zone" (I believe you the issue is not from the untrusted Internet zone), and either :
- in the dropdown list, choose Low
- or check the radio buttons so that everything is accepted and enabled. Just to make sure you are not restricting anything to execute.
How low can you go ? (MS rant)
|
|
|
|