|
Yup, set up a Windows.Forms.Timer (there's lots of different timers) set the interval to 5000.
And then inside you can call myControl.Update(); or myControl.Refresh(); or myControl.Invalidate(); .
One of those should probably do it.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
Thank you very much.Can i do that on asp.net page???
I would really appreciate if you can give me more tips on how to do it on a web page?
Thank you!!!
|
|
|
|
|
Well, i assume you wont be using the Windows.Forms.Timer on a webpage, but there are other timers, like, System.Timers.Timer
Apart from that, i don't know.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
You should look at the AJAX framework and the update panel.
|
|
|
|
|
I have an application that takes images and stores them automatically in a folder on my local drive. The application auto increments the file name by adding 1 to the last one taken. I name the images as photo_00001 and the next taken photo names as photo_00002. Now I want to look through the folder and select the last image taken that is the one with the highes name. Any ideas how I can achieve that?
a novice
|
|
|
|
|
Hi, there are a couple of solutions:
- use Directory.GetFiles() to get all the file names, then find the "highest" file name in those.
- use Directory.GetFiles() to get all the file names, then find the latest file by comparing
creation times using File.GetCreationTime()
- do a binary search for filenames that match your syntax, checking existence with File.Exists()
- teach your app to save the latest file name (a single string) in a fixed location, probably
a file in the same folder ("latestFile.txt").
- teach your app to save the latest file name (a single string) in the registry somewhere.
Probably not good:
- do a linear search for filenames that match your syntax, checking existence with File.Exists();
is slow and might return a hole in the sequence if you somehow deleted an older file.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
How to get current date from MonthCalander control???
Thank You!!
|
|
|
|
|
In the month calendar you can select a range of dates accessible by SelectionStart, SelectionEnd and SelectionRange properties.
|
|
|
|
|
Hi to all !
i wants to block an Ip address to not send or recieve data from that ip. can anyone help me that how i can block urls.
thanks to all
Tahir
|
|
|
|
|
You'd have to intercept the packets i guess. Then read them to see the destination / source and block them accordingly.
It seems more like a C++ Jobby to me, but i've never really looked in to networks with C#.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
I am using a contextmenuStrip in Treeview . The problem is When
1. Open Context menu strip by right clicking TreeNode.
2. Do not select any item in Context Menu Strip .
3. Select any TreeNode in Treeview . Now Context Menu Disappears. (This is fine)
4. Now press any keyboard Key . Nothing is working . The control is still
with ContextMenuStrip popup menu even though it is has disappeared.
How to solve this problem ?. How to disable the Key down event in ContextMemuStrip ?
I am able to trap PreviewKeyDown event for ContextMenu but not able to diable Key Down event in Context Menu.
|
|
|
|
|
Varad_Rajan,
What should happen if you press any key down?, Also, what event are you using to display the ContextMenuStrip?
I don't quite understand what the problem is...
Regards,
Gareth.
|
|
|
|
|
Tnanks for your reply Gareth. I do not want anything to happen when I press Key down.
I have added the contextMenuStrip in form at design time. I have displayed items in it and using the mouse click event for functionality. But when I press Key down event in context menu and when I go back to Treeview and press Key down the control is going to Contextmenu. It is supposed to go to Treeview.
I am surprised why in keydown event control is going to Contextmenu when It has been closed .
Hope you have got my problem ..
Regards,
Rajan
|
|
|
|
|
Adding one more to thread...
When I do the above and press Keydown in Treeview the application throws an exception saying arithmetic underflow or overflow error? Do you have any idea of this ?
Thanks,
Rajan
|
|
|
|
|
I have never had that error before, but a quick check on MSDN:
http://msdn2.microsoft.com/en-us/library/6a71f45d(VS.71).aspx[^]
* Integer arithmetic overflow either throws an OverflowException or discards the most significant bits of the result (see below). Integer division by zero always throws a DivideByZeroException.<br />
* Floating-point arithmetic overflow or division by zero never throws an exception, because floating-point types are based on IEEE 754 and so have provisions for representing infinity and NaN (Not a Number).<br />
* Decimal arithmetic overflow always throws an OverflowException. Decimal division by zero always throws a DivideByZeroException.
What are you trying to do?, you'll need to show some code.
Regards,
Gareth.
|
|
|
|
|
Varad_Rajan,
OK, i understand a bit better now. Like i said in my first post, whats the event your using to display the ContextMenuStrip?
Regards,
Gareth.
|
|
|
|
|
I am not using any event to display the context Menu Strip.
It is declared as
private System.Windows.Forms.ContextMenuStrip DimensionModify;
in class designer of form When I add it in visual designer.
I am using DimensionModify.show() or DimensionModify.Hide() to display or hide the contextMenu .
|
|
|
|
|
Varad_Rajan,
If you have added it to the TreeView1.ContextMenuStrip property in the designer, why do you need call Show() or Hide(), as its automatically done and you don't need to worry about that.
Regards,
Gareth.
|
|
|
|
|
You are right Gareth. It automatically appears as you said.
But in certain situations for functional aspect I need to show or hide it.
But the problem comes when I press key down after I show the context Menu.
The control after that for keydown always goes to context menu. Why is not coming back to Treeview for Keydown.
|
|
|
|
|
The only thing i can think of is that the context menu still has focus. So you when close the context menu, you need to set the tree view to have focus.
Regards,
Gareth.
|
|
|
|
|
My doubt is After the context menu is displayed, the context menu is still there even after I close it explicitly. When I minimize and maximize the form the keydown event is going back to treeview. But I am not able to achieve this programatically.
|
|
|
|
|
I tried Gareth , focusing, activating treeview But still the keydown control goes to ContextMenu. I tried to Minimize and Maximize the form programatically to make context menu lose focus but it is not working.
Thanks
|
|
|
|
|
This is wierd. How about trying to disable, then enable the context menu. Disabling it should stop it doing whatever it is, that its doing.
this.contextMenu.Enabled = false;<br />
this.contextMenu.Enabled = true;
Unless of course re-enabling it straight away means that nothing actually happens. Don't know 'till you try i guess.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
Through VS 2003 (.NET 1.1) we are generating an XML file, the owner of the file is always Computer Name. But we want the windows user, creating the file to be the owner.
We have achieved this change in ownership through VS 2005 (.NET 2.0), but are unable to do so in VS 2003 (.NET 1.1). If anybody has any knowledge on this do share it with us.
Destination folder in which the file has to be created is in shared path on another server.
Any help in this regard will be highly appreciated.
Thanks in advance!
|
|
|
|
|
Hello all...
Can any one please tell me how can we add .rpt and .cri extensions in IIS (windows 2000 with crystal reports 9 installed on the same). For crystal report 8 we need to map these extensions to "C:\Program Files\Seagate Software\WCS\Wcsinsapi.dll" but this is not the case with CR 9, so i am wondering if anybody knows how will it work for crystal report 9(CR 9).
Any suggestion will be helpful... i really got while trying it from 1 whole day... please help me friends...
People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily
Akhilesh Singh
|
|
|
|