|
FYI, the Help button raises the HelpRequest event. It won't bring up the context sensitive help available via F1 or the ? button in the title bar, which probably comes courtesy of the Control.HelpRequested event.
Alan.
|
|
|
|
|
This will happen if you're creating the message box in a different thread. Make sure that any event handlers on asynchronous processes (network communication, serial ports, BackgroundWorker, TPL or ThreadPool background tasks, etc) that refer to the UI get BeginInvoke'd.
You mentioned a splash screen ... that is often done on a separate thread to the main UI, so check you haven't ended up creating message boxes in that thread.
|
|
|
|
|
No threading in the app. Not even the Splash. No "weird" things involved except creating some bits and pieces on the fly.
I even tried setting the owner on the dialog, hoping it would pass it along and fix the problem, but to no avail.
Another odd thing the app does: when starting, it will appear on the screen wherever the mouse cursor happens to be, i.e. start it on monitor 1, then move the mouse over to monitor 2 to do something else and it will show up over there on monitor 2. (Extended display, dual monitors)
Programming is SO much fun. :p
|
|
|
|
|
|
Hmmm... ForegroundFlashCount was set to 7.
We'll see. Thanks.
|
|
|
|
|
I need a thread to invoke any delegate that I send to it.
What is the accepted pattern for having a .NET thread process messages?
Should I:
1. Create a hidden Form and override the WndProc function?
2. Use a Background Worker? (The problem with the Background Worker is that you can't send it a message if it's already busy.)
3. Use a loop with an AutoResetEvent to wait for new messages?
4. Something else?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Richard Andrew x64 wrote: 1. Create a hidden Form and override the WndProc function?
No, that thread is meant to handle the UI. It'll hang (along with the UI) if it's already busy, as stated in point 2.
Richard Andrew x64 wrote: 2. Use a Background Worker? (The problem with the Background Worker is that you can't send it a message if it's already busy.)
One can only process one thing at a time. You could consider queuing the request, or to use multiple threads.
Richard Andrew x64 wrote: 3. Use a loop with an AutoResetEvent to wait for new messages?
Loop within a Thread[^] from the ThreadPool . Easiest would be to check for new items at the begin of the loop
|
|
|
|
|
That depends on what you really need.
In my case I created a class (ActionRunner... and later a RunnableRunner). I use a Thread from my own pool of threads. It waits for a new Action (using a ManagedAutoResetEvent) and uses a Queue to effectively queue the Actions.
So, while there are items in the queue they are executed. When there are no more, an wait is done. My own ActionRunner is disposable, but that's to guarantee that I free the thread at the right moment. I consider it the best solution as it does not creates an unnecessary window and because the messages are real .Net actions (and not some number that must be processed by a switch).
|
|
|
|
|
Depends on what you need.
If you want to respond to messages and spawn parallel tasks that don't depend on each other, then check out the Task Parallel Library, or BackgroundWorker.
If you want a queue of messages that a thread works through one by one, then I'd implement a background thread class (i.e. wrap a Thread) with a Queue<Message>, and do the queue pumping myself.
|
|
|
|
|
Hi! How to end session after logging out? I am facing a problem that when clicking on logout session ends. After clicking on back button, previous page repeats again. This happens in all the pages of my project.
Here is the code for logout link..
protected void linklogout_Click(object sender, EventArgs e)
{
if (linklogout.Text == "Log Out")
{
Session["username"] = null;
Session["userid"] = null;
Session.Abandon();
Response.Redirect("~/index.aspx");
}
}
Can any one help me?
|
|
|
|
|
I would have a read of this
how do you programatically end a session in asp net[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
<script language="JavaScript">
javascript:window.history.forward(-1);
</script>
this is how i ends in asp.net
|
|
|
|
|
You are successfully killing the session there, so the previous page should no longer be active. (That is, nothing on it should work, because there will be no valid session for any action, and F5ing it should result in a failed authorisation and a return to the login page.)
What you need to do if you don't want browsers to show the page is make all your secure pages uncacheable. To do this in all browsers I think you need to set Pragma: no-cache, Cache-Control: none and also Expires: to a date in the past.
|
|
|
|
|
Hey this problem is solved as I use:
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">
But today another problem came..
I have two links in my home page namely Register & Login. They are kept in a panel control and when I press enter from login popup it should be login. Till now every thing works.
When clicking on them(links) individually two modalpopups shown. When I press esc button they should be closed. But it is not working in a panel if I give BehaviorID to popup. Can any one help me?
Here is the asp.net code....
<script type="text/javascript">
//closes the popup by pressing the esc button on the keyboard
document.onkeyup = Escape;
function Escape()
{
var KeyID = event.keyCode;
if (KeyID == 27)
{
if ($find("MPEregisterescclose"))
{
$find("MPEregisterescclose").hide();
}
else if ($find("MPEloginescclose"))
{
$find("MPEloginescclose").hide();
}
}
}
</script>
|
|
|
|
|
ofter XML generate how will send XML file in Tally 9.0
|
|
|
|
|
May I suggest that you should really ask this question here[^].
|
|
|
|
|
I would like to know haw to check if a record exists before the record is deleted
|
|
|
|
|
I am not sure why you need that. If you just want to display number of deleted records in screen you may use ExecuteNonQuery method. It returns number of rows that were affected by the command.
"Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[ ^]
|
|
|
|
|
What sort of record? Where does it exist: database, flat file, jukebox? Try providing some proper detail to your question.
|
|
|
|
|
Don't. If you have a recordId, assume it exists and delete it - catch the exception if it did not. Adding checks like the one you proposed might say it exist, and still be deleted (by someone else) an instance later (unless it's an atomic operation, which I doubt).
|
|
|
|
|
if you delete it while it doesn't exist SQL will return something like: "0 rows deleted".
Delete from tableX where myconstraint='Myconstraint';
If you do it in code you can get that by reading out the NrOfRowsAffected property when doing an ExecuteNonQuery statement. Same goes for Insert and Update queries eg.
as someone already replied, checking if it exists is inaccurate at best and doesn't add any functional advantage.
if you really, really must check it. Perform a select query perhaps with a count.
Select count(id) from tableX where myconstraint='Myconstraint'
if count > 0 , the record exists.
hope this helps.
|
|
|
|
|
If it's a database, then the system will do that for you.
|
|
|
|
|
I presume we're talking about database records.
In which case, why do you care whether it exists? Delete it anyway - you're not going to get an error saying that 'this record you don't want doesn't exist'.
Strange question.
|
|
|
|
|
develop the project in microsoft.net through C# on topic window based simulator using backpropogation algorithm.
|
|
|
|
|
You need to post your full assignment so we can really mock you.
|
|
|
|