Well, how "appropriate" the answer is depends entirely on what the hell you mean by "create monthly calender".
That could mean anything! Are you trying to come up with a control that lets you input a date, a data range over months, something to display an entire month, storing data based on some month requirement, ... ??? WHAT?
Shortcuts generally work whichever control on a form has focus, unless the control explicitly steals that character (i.e. text boxes with Ctrl+C/X/Z/V). I think you need to put a shortcut handler on every form, though, if you want app-wide ones.
Yes, it is, but you will have to go on treacherous ground to do so (needs some unmanaged code). Take a look at keyboard hooks, more specifically RegisterHotKey and UnregisterHotKey, both from user32.dll.
Google it further, there are a lot of threads detailing how this can be achieved, for instance here[^], or here[^]
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
My need will be to make an hrttprequest in asynchronous mode. To not let the user wait for a response that can be processed in backround.
First I was thinking to use a BackroundWorker, then I see that begingetresponse example
But it react exacly as the BeginResponse : when I step over it wait a few seconds to get the response.
So maybe I misunderstand something but I don't see any advantage of this method ??
BeginGetResponse will execute the method in the AsyncCallBack asynchronously. If you do like in the MSDN example then it will wait for that asynchronous operation to finish
this is the code that will cause it to wait and also implements a timeout method so if the asynchronous operation takes to long it will end the asynchronous operation.
// this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
ThreadPool.RegisterWaitForSingleObject (result.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), myHttpWebRequest, DefaultTimeout, true);
// The response came in the allowed time. The work processing will happen in the
// callback function.
I'm thinking you must have missed something initially, BeginGetResponse should return immedialtely.
The only reason I would see to run that in a dedicated thread is if you want to worry about a timeout or want to ensure the asynchronous method completes like the example, as the method will block waiting for the ManualResetEvent to be set. Using the ManualResetEvent is for situations where you can't process the next step until that process has completed.
Some more investigation turns out this is a known issue. Apparently it blocks during the name resolution so does not return immediately as you would think. Sorry, I should have looked into it a little more before replying.
I have two databases(SQlserver and MS Access) with same schemas (same tables). SQL server database has data but Access has no data (blank database).
My goal : when user enters a ClientId and click insert button then I need to retrive that single record from all tables in sql server database and insert into tables in MS Access Database.
Achieved: i retrived from all tables in sql server databases with client id and stored the data in Dataset.
Problem: Insert into Access tables????
i have table array and i am looping thru all tables in array and trying to insert data from above dataset into Ms Access dynamically.
Can you suggest how insert into Access for all tables dynamically in loop . i cannot wrie insert statement for each table. i need one which is generic for every table so that i will pass parametrs. Its not a bulk insert, its single record push into multiple tables.
-------This is My code-------------------------------------------------------
If you have two datasets 1) from MSSQL 2) from MS Access and all column names and table names match you should be able to iterate the datatables in the datasets and us importrow method to copy a row from one to the other and then use data adapter to execute update command and should use the assigned insert/update commands assigned to the data adapter to populate the data into the database.
You have no reason to have all the data in memory at once so use a DataReader, not a DataSet.
0) ExecuteReader on the SELECT command
1) Iterate the DataReader's columns to create the INSERT command and its parameters
2) Read from the DataReader
3) Set the INSERT command's parameter values
5) Repeat from 2 as necessary
You should also use a try/catch and a transaction.