|
Use a custom ListViewItem or something with the properties you want, and in the handler for the ListView.SelectedIndexChanged event, set the PropertyGrid.SelectedObject to your custum ListViewItem . You should read about the classes in the System.ComponentModel namespace for ways to provide custom TypeConverter s and UITypeEditor s for those properties if you require it.
-----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 all!
Possible do toolbar flat as in IE6.0?
I know that in VC6.0 this was not a problem.
But in VC.NET, I can not do this.
|
|
|
|
|
ToolBar.Appearance = ToolBarAppearance.Flat
-----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-----
|
|
|
|
|
Many thanks.
You me much helped.
|
|
|
|
|
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.
i want to write only one try/catch block that can handle all the exceptions of the whole applications(windows Application), which off-course may contains multiple windows forms
Ali Khan
|
|
|
|
|
AppDomain.UnhandledException
You can get the current AppDomain with AppDomain.Current .
-----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-----
|
|
|
|
|
I've been battling this too long and wanted to see if someone can help.
I've created a directory on our Win2k Server. The directory automatically assumes I want to inherit the parents (i.e. the box under the security tab that says "Allow inheritable permissions from parent to propagate to this object"). Ok, that's fine, but I would like to turn that option off through my C# script. I can add ACE's and modify everything at the ACE level, but haven't found anything that states how to change this option.
I'm sure it is simple, but I haven't been able to figure it out.
Thanks!
|
|
|
|
|
I need a way to be able to detect when ac power to my computer is not available. My cpu is on an UPS and system power management does not catch this event if i unplug the UPS and my system runs on battery. I read the documentation for the system power management class and it will detect an ac to battery power event for a system (internal battery) battery. Does anyone know of a way i can detect when power is coming from a battery in the UPS? Thanks in advance!
|
|
|
|
|
Well, to the computer it's still just AC power. But AFAIK many UPS power supplies have some sort of serial-port or USB connection, and drivers that tell the computer when it's on UPS battery power.
I'm not an expert on this by any far stretch, though, so I can't really answer you question completely.
|
|
|
|
|
jdunlap's correct. Unless the UPS is connected to your computer by something other than your computer's power cord, there's no way for your computer to know.
Old UPS's used serial ports, and a lot of the newer ones use USB, but in either case the UPS has to "tell" the computer. Take a look at the documentation for your UPS.
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
-David St. Hubbins
|
|
|
|
|
I am trying to add an arraylist to a datatable. The ArrayList contains a struct and the the struct basically holds several object variables. I use a foreach statement to loop through the arraylist and add the data to a datarow then add the datarow to a datatable. However, when I try to add the second datarow I get an error message saying 'This row already belongs to this table'. Even though I know the data has changed the it is a completely different row. I am including my code snippet, any suggestions is appreciated:
r = DataSet.Tables["TradeOrderFills"].NewRow();
theData = (ArrayList) oFills.GetByIndex(0);
Console.WriteLine("theData count "+theData.Count);
foreach(TradeData td in theData)
{
Console.WriteLine("Adding Row to DataTable");
Console.WriteLine(td.ticker);
r["preTicker"] = (string)td.ticker;
Console.WriteLine("column value "+r["preTicker"]);
Console.WriteLine(td.transactionType);
r["preTransType"] = (string)td.transactionType;
Console.WriteLine("column value "+r["preTransType"]);
r["preOrderTime"] = (string)td.orderTime;
r["prePrice"] = Convert.ToSingle(td.price);
r["preQ"] = Convert.ToSingle(td.fillQ);
r["preAccount"] = (string)td.account;
r["preBroker"] = (string)td.broker;
r["preStatus"] = (string)td.status;
DataSet.Tables["TradeOrderFills"].Rows.Add(r); //THIS IS WHERE THE ERROR OCCURS ON THE 2nd ITERATION
Console.WriteLine("Number of Rows "+DataSet.Tables["TradeOrderFills"].Rows.Count);
}
|
|
|
|
|
Move your first line:
r = DataSet.Tables["TradeOrderFills"].NewRow();
inside the foreach loop.
What you were doing is inserting the same physical row each time, but just changing the data it contained. You need to create a new physical row on each iteration.
--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#
|
|
|
|
|
How do I create a new GUID using C#?
I tried this but it shows up as 00000000-0000-0000-0000-000000000000.
Guid guid = new Guid();
Console.WriteLine( guid );
|
|
|
|
|
Try the static method Guid.NewGuid()
You can find more information on MSDN[^]
--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#
|
|
|
|
|
Thanks!
|
|
|
|
|
I have a class library project that gets its configuration from a customm configuration section (using the System.Configuration.IConfigurationSectionHandler interface and friends). When I want to access my configuration section, I make a call to ConfigurationSettings.GetConfig("BarcodeLoggingConfig") and voilà !
This morning my boss asked me if I could make it dynamic, meaning that if somebody changes the configuration, the client application updates itself (like a service that you don't have to restart if you change the config).
Is there such functionality in the .NET Configuration?
I know that I could use the FileSystemWatcher and easily figure out the configuration file name, but what if the application is ASP.NET and has a hierarchy of web.config files?
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
You could setup a file dependency on the config file.
As for ASP.NET, the changes will happen automatically the next time the user reloads or refreashes the page.
|
|
|
|
|
This isn't the only thing that needs to be done, though. Yes, you could use a FileSystemWatcher to watch the .config file for changes, but once an AppDomain has been created and the config file read, it won't get read again (it's cached). Instead, you have to have a separate process (or use the same process, which must start your main app in a separate AppDomain ) that watches for changes, notifies your app to quit (or have your main app watch for changes, and the loader restart it when the app exits with a certain exit code). It creates the AppDomain with your custom AppDomainSetup for the AppDomain.SetupInformation , launches your process using AppDomain.ExecuteAssembly , and, thus, respawns your process.
I have covered this in more depth before. Please search the forum comments for keywords like AppDomainSetup for more information.
-----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-----
|
|
|
|
|
Is it a bug of a feature that AcceptButton only seems to work with Form.ShowDialog() and not with Form.Show()? That is, when a form is displayed with Show(), the Enter key is ignored, but with ShowDialog(), the Enter key causes the form to be accepted (OK).
Arun
|
|
|
|
|
Hmm... would that be because the modal nature of a dialog box? It seems logical to me that a modal dialog could be dismissed with an accept button, but not necessarily a modeless form.
|
|
|
|
|
I think that it has to do with the ShowDialog [^] form being modal, and that Show [^] is inherited from Control [^], which only makes the Form visible. When it's modal, it's usually a form in which the user has to give some input, and press Enter to accept (or Esc to cancel).
- Daniël Pelsmaeker
There are 10 kinds of people in the world. Those that understand binary and those that do not.
|
|
|
|
|
I have a worker thread that is implementing a TcpListener socket. The Thread is blocking on the AcceptSocket method of TcpListener, which is fine. My problem is closing the blocked thread. I'm using:
Thread.Abort() and Thread.Join() to attemp to stop the thread and wait for it's termination but it apears that the Abort method does not throw the ThreadAbortException that it is supposed to. Any thoughts ?
|
|
|
|
|
Take a look at this.
Basically, all bets are off on aborting threads using certain system resources, like sockets. That's probably why it's not working, but I'm not sure of the best solution for you (would need some more info I think).
I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.
-David St. Hubbins
|
|
|
|
|
Hello all, I am writing a windows service that I plan to run in a machine that has the .net framework but without the .net ide. I am curious as to how i will go about installing the service if i can not access the visual studio .net command prompt? Any help would be appreciated...
Frank
|
|
|
|
|
All tools for installing .NET services are in the .NET Framework. InstallUtil.exe is the one you want. located in:
%WINDIR%\Microsoft.NET\Framework\%version%\InstallUtil.exe
Jonathan 'nonny' Newman
blog.nonny.com [^]
|
|
|
|