|
why are you trying to muck around with the asp.net script files?
|
|
|
|
|
I'm not trying to modify them or anything. I created a custom validator (that implements IValidator, but doesn't derive from BaseValidator), and was hoping I could just use the available script for client side validation, rather than have to rewrite my own.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
BaseValidator gets the path to the script files from the internal static System.Web.UI.Util.GetScriptLocation method, which gets some of its info from the internal System.Web.Util.VersionInfo.SystemWebVersion property.
GetScriptLocation looks up the "clientScriptsLocation" setting in the machine.config file. but that string has parameters which are filled in by SystemWebVersion.
You might be best off either using reflection to get to the GetScriptLocation method, or querying the .config file for the root path, and then scanning that folder for the highest version.
|
|
|
|
|
Hi, I have a little problem with the 'Clipboard' class. I am attempting to transfer data from the windows clipboard to a bitmap object and appear to be leaking memory. The following code placed in a button on a windows form will cause a significant amount of memory to be allocated and only partially freed. You must manually 'copy' an image onto the clipboard prior to running this code.
System.Drawing.Bitmap bm;
IDataObject iData;
iData = (IDataObject) Clipboard.GetDataObject();
for (int i = 0; i < 100; i++)
{
if (iData.GetDataPresent(DataFormats.Bitmap))
{
bm = (Bitmap) iData.GetData(DataFormats.Bitmap);
if (bm != null)
{
bm = null;
}
else Console.WriteLine("Bitmap was NULL");
}
}
If the 'bm=(Bitmap)...' line is commented out no memory will leak.
I have been using an approximately 512x512x32 BMP for my tests.
Note : This code is simply to test the leaking problem. The real code places a different image on the clipboard every time through the loop and then works with the data in the if (bm != null) {...} block.
|
|
|
|
|
How are you checking the memory use? There's nothing in your code that forces the bitmap to be freed, so memory is going to be hanging around until a GC happens.
You could call bm.Dispose() to free it early.
|
|
|
|
|
I have tried inserting a GC.Collect(); after the BM=null; line. This did not seem to have any effect. I also placed a GC.Collect(); after the entire loop ran to see if it cleaned up any - it did not.
I have also tried replacing the
'bm = (Bitmap) iData.GetData(DataFormats.Bitmap);'
with
bm = (Bitmap) new Bitmap(512,512); // or whatever that constructor is
This then worked - the memory fluctuated by a couple megs up and down but after the routine exited left no memory in use. This was even without a GC.Collect(); line in the routine.
Oh, I also did try bm.Dispose(); but this also did not free the bitmap.
Lastly, I am looking at the NT's task manager - not the most fine of memory gauges, but each bitmap I get uses about 1 meg of memory. A loop of 100 iterations will cause the task manager to show nearly 100 megs more in use.
Thanks for the reply!
|
|
|
|
|
Is it possible to develop a disk format application without depending on windows or dos format tools?
Jassim Rahma
|
|
|
|
|
I added a status bar and a panel to a form. I then set the panel's borderstyle to fixed3d (this way I can see all sides of the panel) and set the dock property to DockStyle.Fill.
The problem is that the panel gets tucked underneath the status bar. This can be fixed by right clicking the panel and selecting 'bring to front'. Unfortunately I will be adding the panel dynamically, so I need a way acheive the same effect of 'bring to front' via code.
Any help would be greatly appreciated.
Thanks,
Steve
|
|
|
|
|
Try:
myPanel.BringToFront();
The BringToFront() method is part of the Control class.
Later,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Duh ! I don't know why I thought bring to front could only be used from the IDE. Man, I feel stupid.
Thanks Nathan
|
|
|
|
|
Not stupid.... Just overworked
Glad, I could be of help.
Later,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Try changing the order or creation of the status bar and panel.
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
That was the first thing I tried. I did every possible combination for creating and defining the two controls.
Thanks for the suggestion though
|
|
|
|
|
Hi,
Does anyone know if it is possible to call the Scheduled Task interface from C#. Its located here Start -> All Programs -> System Tools -> Scheduled Tasks. Once you Add a Scheduled Task and you get the properties of it -- this is the interface I would like to call. Is there a class in C# that will handle this. I have seen Symantec using this in their Norton AntiVirus program. Any help would be greatly appreciated since I need to do this in my program. Thanks
cAptHiDDeN
|
|
|
|
|
|
Yes very similar to this, but is there a way to called the actual design interface within windows without having to shell out into DOS. It would be nice to call the interface design within windows. There has to be someway to call this but I can not seem to figure it out. This is what I am trying to call: If you got to Start --> All Programs --> Accessories --> System Tools --> Scheduled Tasks. Click Add Scheduled Task and pick the options you want for your particular job. Once your job is add, click on it and get its properties. A window pops open showing you the job you just scheduled. This is the window, I am trying to call. Is it possible to call this either from a class library or a dll in windows? If this isn't possible, is there a way to call the actual wizard (Add Schedule Task)built into windows?
If anyone else might be able to provide me with some help, I would be greatful. Thank You.
cAptHiDDeN
|
|
|
|
|
I'm in the middle of writing a Source Safe automation tool and I have a Traversal method which takes a delegate. While I've used delegates quite a bit in the past I've never really run into the issue where I've needed to pass things along to my delegate that couldn't be found derived during the traversal. IE Checkout delegate needs a checkout destination. I have ideas, but would like some more if anyone has some.
|
|
|
|
|
I don't understand what you're asking. What does the delegate need to do?
|
|
|
|
|
Actually I solved my problem nicely or at least nicer than my quite poor path was taking me earlier. Here is what I was in need of solving, what I was thinking of doing, and what I did:
I had a traversal method which accepted a delegate as a param. This method is, of course, called during the traversal on each VSSItem retrieved from the database.
My original goals was to pass the extra arguments need by each different delegate implementation through the traversal method and then pass them into the delegate call each time. While this may be fine and dandy when you know the signature of the method I didn't want to do that. I thought of using a param list but that isn't really nice either, avoid indexers at all cost type of thing. So my final thought was really what I need is a sub-class, or external, whatever ties your shoes, that would take care of that type of process. IE a GetHistory, GetFile, or Checkout class that really only concerned itself with one file at a time, but knew what it needed and only that (selfish I know). That class exposed a method that was used as the delegate. Its quite nice and quite clean. Any thoughts...
|
|
|
|
|
That sounds reasonable. It's similar to the way events typically work; they always pass the sender as an object, and then the values as a class derived from EventArgs.
|
|
|
|
|
i heared that there is a function in c# that convert images from a format to another ( like from bmb to jpg)
do anyone know it?
|
|
|
|
|
The idea is to use the Image class to load an image in one format (FromFile static method) and save it with another format (Save method). For example:
Image img = Image.FromFile("image.jpg");
img.Save("image.bmp");
That's it!
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
Is there a way of applying something similar to the web's "session" to a windows application (many forms, MDI parent window)? I want users to be logged out after 20 minutes.
Thanks
|
|
|
|
|
Hi,
You can use a Timer. Activate it on application start, set it for 20 minutes, and reset it everytime the user does the required function, like clicking a specific button or whatever... I have used it for a BlackJack game where the user has 1 minute to bet, if not he get removed from the game and the game continues. Just a tip, print starting and stopping times in the console so u can see whats happening .
Hope this helps
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
I was thinking of this, but the application is complex and contains multiple windows. So i'd need to map every navigation back to the original window and its timer, which is not really practical.
|
|
|
|