|
plz give me appropiate answer.
|
|
|
|
|
sutapa das wrote: plz give me appropiate answer.
I'm not sure but maybe this link can help you.
How to create your monthly calendar.
Moreover, you don't have to post the same question to get your answer faster.
It won't work here.
|
|
|
|
|
Why not just use one of these[^], or one of these[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
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?
|
|
|
|
|
Hi,
Is it possible to make a shortcut in application level not control level so no matter where the focus is or which form is active, shortcut will be invoked?
|
|
|
|
|
You can use the PreviewKeyDown event to see what key is pressed at the Form level.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
As a side note to your answer you also need to set the KeyPreview property to true for the form.
|
|
|
|
|
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.
|
|
|
|
|
If your application has an MDI form, you can create a menu item with the intended code and assign a shortcut to it. It would work "universally" in your entire application.
|
|
|
|
|
Hello
Does anyone have already experienced the BeginGetResponse illutrated in the Microsoft example ?
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetresponse.aspx[^]
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 ??
Thank for your help
|
|
|
|
|
When you run it, is it timing out? Or is it receiving a response?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
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.
ThreadPool.RegisterWaitForSingleObject (result.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), myHttpWebRequest, DefaultTimeout, true);
allDone.WaitOne();
|
|
|
|
|
Thank for the answer
But it seems that the BeginGetResponse itself takes long to come back
// Start the asynchronous request.
IAsyncResult result=
(IAsyncResult) myHttpWebRequest.BeginGetResponse(new AsyncCallback(RespCallback),myRequestState);
I test it a few times yesterday
But today I try again and now it return immediately !
Even if I cut the network connexion !
I probably miss something !
Some told me that I have to wrap this code example in a dedicated thread !
But if so I dond see the advantage of using the BeginGetResponse
|
|
|
|
|
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.
|
|
|
|
|
Thank you Trak4Net
Ok ... maybe I was too tired yesterday
I will try again tonight
But indeed I'm expecting that BeginGetResponse return immediately whatever the connexion state !
|
|
|
|
|
|
Hi ALL,
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-------------------------------------------------------
private void InsertMsiClientIntoTest(string ClientId)
{
SqlConnection sqlConnection = null;
SqlDataAdapter sqlDataAdapter = null;
DataSet sqlserverDataset = new DataSet();
sqlserverDataset.Tables.Add();
sqlConnection = new SqlConnection();
sqlConnection = new SqlConnection("Data Source=THINK;Initial Catalog=" + dbName + ";Integrated Security=True;");
sqlConnection.Open();
sqlDataAdapter = new SqlDataAdapter(ClientSQL.PopulateTables, sqlConnection);
sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@ClientId", cmbId.Text);
sqlDataAdapter.Fill(sqlserverDataset);
GetDataFromTablesForID(sqlserverDataset);
InsertAllTableDataIntoAccess(sqlserverDataset,tableArray);
}
private DataSet GetDataFromTablesForID(DataSet dsTablesList)
{
SqlConnection sqlConnection = null;
SqlDataAdapter sqlDataAdapter = null;
string tableName = string.Empty;
string QueryText = string.Empty;
int i =0;
tableArray = new string[dsTablesList.Tables[0].Rows.Count];
DataSet sqlserverDataset = new DataSet();
sqlserverDataset.Tables.Add();
sqlConnection = new SqlConnection();
sqlConnection = new SqlConnection("Data Source=THINK;Initial Catalog=" + dbName + ";Integrated Security=True;");
sqlConnection.Open();
foreach (DataRow itemRow in dsTablesList.Tables[0].Rows)
{
tableArray[i] = itemRow[0].ToString();
i++;
}
foreach (string tableItem in tableArray)
{
tableName = tableItem;
QueryText = "select x.* from" + " " + tableName + " " +
"x inner join ClientMajor ci on ci.ClientId = x.ClientId where ci.MajorClientId =@ClientId";
}
sqlDataAdapter = new SqlDataAdapter(QueryText, sqlConnection);
sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@ClientId", cmbExceedId.Text);
sqlDataAdapter.Fill(sqlserverDataset);
}
return sqlserverDataset;
}
private void InsertAllTableDataIntoAccess(DataSet Inputset, string[] tableArray)
{
string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["mdb"].ToString();
OleDbConnection oledbConnection = null;
OleDbDataAdapter oledbDataAdapter = null;
DataSet resultSet = new DataSet();
oledbConnection = new OleDbConnection(connectionstring);
oledbConnection.Open();
foreach (string tableItem in tableArray)
{
//????????? I NEED THE FOLLOWING CODE......////////////???????
oledbDataAdapter.InsertCommand.CommandText="insert into "
oledbDataAdapter.Fill(resultSet.Tables[0]);
}
}
Thanks in Advance...
|
|
|
|
|
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.
|
|
|
|
|
Why would you do this ?
|
|
|
|
|
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
4) ExecuteNonQuery
5) Repeat from 2 as necessary
You should also use a try/catch and a transaction.
modified 30-Jul-12 11:39am.
|
|
|
|
|
Hi;
How can I data transfer between two active forms. from FORM 1 to FORM 2.
|
|
|
|
|
You can use delegates to pass data between forms - this article[^] describes this approach in some detail.
modified 29-Jul-12 6:33am.
|
|
|
|
|
Hi Abhinav, please note my comment (written today) on that article you linked to, indicating what I think is a major flaw in its implementation.
best, Bill
"Everything we call real is made of things that cannot be regarded as real." Niels Bohr
|
|
|
|
|
That depends on what you're transferring and why.
There are various methods to do so, some more appropriate than others depending on what your application is doing.
Form2 could expose properties that your Form1 code sets, or you could use delegates to pass data to a method on Form2, or both forms could be using the same data object where Form1 sets some values in this object and Form2 picks it up by some notification method the data object exposes, ...
|
|
|
|