|
The article I linked to suggests how this can be achieved using C#.
|
|
|
|
|
Looks like SaveSetting was storing data in a file (maybe ini) or database.
You will need to implement similar functionality. Check if you are referring an external dll that contains this method's implementation.
|
|
|
|
|
If you are using C# in WinForms, you have the "Application Settings" facility to help you persist values:[^].
Other strategies, besides Registry manipulation, and Application Settings, include serialization, and deserialization.
CP has very good articles on serialization and de-serialization, just search for them: Mehdi Gholam's recent work on "Fast JSON" is outstanding: but, perhaps more relevant to situations where you need to store and retrieve large amounts of information:[^].
best, Bill
"Our life is a faint tracing on the surface of mystery, like the idle, curved tunnels of leaf miners on the surface of a leaf. We must somehow take a wider view, look at the whole landscape, really see it, and describe what's going on here. Then we can at least wail the right question into the swaddling band of darkness, or, if it comes to that, choir the proper praise." Annie Dillard
|
|
|
|
|
Thanks alot bill
im probably going to have a poke around in application settings, i always hated them in vb thats why i used the reistry, but im going to have a good research into persist values and see what i can learn
thanks again
Ian
|
|
|
|
|
Microsoft doesn't want you storing app settings in the registry anymore. Why would you anyways? The application settings API is about 1% of the work vs. storing stuff in the registry .
|
|
|
|
|
Hi to all
i am creating an application in c# windows using socket programming..
both client and server is working well.
but main concept is when working both client and server
if no process in client program
For Example :
1). idle in gmail
2). like screen saver in windows when no process
at the time in server system shows or alert Like
" The Client Is In IDLE "
how to do this process in c# windows application.. please any body help.. ( sorry for my English )
|
|
|
|
|
|
If you are wanting to know if only your client program is idle and it is WinForms, you can use this[^].
|
|
|
|
|
If you are asking about the server....
If you have open connections and no traffic is received on them after X time (where X depends on your system) then you close the socket.
The client is responsible for detecting the socket close and re-establishing it once it starts doing something.
|
|
|
|
|
hello guys... i have this datagridview inwhich one of the columns is Checkbox column. I have this following code which works well if I put it into Button's Click Event.
<pre>
ArrayList arr = new ArrayList();
for (int i = 0; i < dgStudents.Rows.Count; i++)
{
bool val = Convert.ToBoolean(dgStudents.Rows[i].Cells[0].Value);
if (val)
arr.Add(Convert.ToInt32(dt.Rows[i]["StudentId"]));
}
</pre>
But this code does not help when I wanna check an individual row. Lets say I check/uncheck third row, then how do I know about this change? I tried <b>CellValueChanged</b> but it did not work. thnx for any help.
-- modified 2-Feb-12 4:02am.
|
|
|
|
|
overloaded Name wrote: Lets say I check/uncheck third row, then how do I know about this change? I tried <b>CellValueChanged</b> but it did not work. thnx for any help.
CellValueChanged[^] is the correct event. Can you paste/post your code here?
Bastard Programmer from Hell
|
|
|
|
|
Here is the code for <b>CellValueChanged()</b>
<pre lang="c#">
private void dgStudents_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if(e.ColumnIndex == 0) //checkbox column
CheckboxColumnValChanged();
}
</pre>
Now here is the code for <b>CheckboxColumnValChanged()</b>.
<pre lang="c#">
private void CheckboxColumnValChanged()
{
if (dgStudents.Rows.Count > 0)
{
//int index = dgStudents.CurrentRow.Index;
//bool IsChecked = (bool)dgStudents.Rows[index].Cells[0].Value;
//if (IsChecked)
// MessageBox.Show("True");
//else
// MessageBox.Show("False");
}
}
</pre>
When I change the third row ONLY THEN it will tell me about 2nd row. But I wanna know immediately when I check/uncheck the 2nd row.
|
|
|
|
|
The DataGridView.CellValueChanged event occurs when the user-specified value is committed, which typically occurs when focus leaves the cell.
In the case of check box cells, however, you will typically want to handle the change immediately. To commit the change when the cell is clicked, you must handle the DataGridView.CurrentCellDirtyStateChanged event. In the handler, if the current cell is a check box cell, call the DataGridView.CommitEdit method and pass in the Commit value.
Taken from here[^].
|
|
|
|
|
Thanx. It helped me
|
|
|
|
|
Do you guys know of any easy way to have one column in a table of which the value auto updates every time an UPDATE statement is called for a specific row?
Either one of the following two scenarios would be fine but I'm not sure what the easiest way would be of implementing it:
1. Let's say there's a column in the table called 'Version' (int ). Every time an UPDATE statement is called, the value of the 'Version' column is automatically incremented by 1 for every row affected.
2. Let's say there's a column in the table called 'Modified' (datetime ). Every time an UPDATE statement is called, the value of the 'Modified' column is automatically set to the current date and time. I have a similar concept to this in my DB with a column named 'Inserted' which has a default value of GetDate() . So for every INSERT into the table, the 'Inserted' column will automatically get the current date and time but I'd like to have something like this for UPDATE as well.
Any ideas? My best idea so far would be to create a trigger on the table, something as follows:
CREATE TRIGGER update_mytable
ON MyTable
FOR UPDATE
AS
BEGIN
UPDATE MyTable
SET Modified = GETDATE()
WHERE RecordID IN (SELECT RecordID FROM INSERTED)
END
But I'm hoping that there might be a more elegant solution.
|
|
|
|
|
This is an elegant solution, and is definitely your best bet here. Note that you should do an = test, not an IN test.
|
|
|
|
|
Thanks. But why would you say that I should use an = test as opposed to an IN test? What if the UPDATE statement affects more than one row? Is there any specific disadvantage to usign an IN test that I should consider?
|
|
|
|
|
I think that's the best approach. It should work for all updates. Second way I can think of is to create procedure for updating the table and using it for all updates, that occur. And inside this procedure you can also update your version and modified columns. But that required you to stick with the procedures for all updates.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
Looks to be a good solution in my opinion.
Just consider using an INNER JOIN instead of IN
UPDATE mytable<br />
Set Modified = GetDate() From myTable A Inner Join Inserted B<br />
Where A.RecordId = B.RecordId
|
|
|
|
|
Thanks. Would you mind explaining the advantage of an INNER JOIN over an IN?
|
|
|
|
|
Sub queries are run in a temporary memory space, hence they can be slower.
However, most engines now are capable of converting sub queries into INs, so in general for new databases, you should be ok with both.
|
|
|
|
|
One thing to bear in mind: GETDATE isn't particularly accurate at the millisecond level. Although the datetime datatype is accurate to about 3 milliseconds, GETDATE does not give you that level of precision, as far as I can gather from a quick google it is somewhere around 15ms although things like machine load can affect it. If you are expecting to do repeated updates to the same row within a very short time period, this may not give you unique values for your Modified column. If your rows will not be updated that frequently, then it's not a problem.
I thought SQL Server supported the ability to automatically timestamp rows when they were updated. The timestamp is just a meaningless number but at least you can check whether a row is the version you expect it to be, and you can also tell the order in which updates were applied.
(I'm assuming SQL Server since you haven't said what database you are using.)
|
|
|
|
|
Hi all,
I have been using this code project to create custom taskbar notification windows. This worked perfectly well in Windows XP, but in Windows 7 the background goes black (instead of transparent) and the custom image gets smeared (as opposed to being clearly re-drawn as it "rises" from the taskbar). Have any of you run into this issue? If so, is there a simple workaround? If there isn't, I would not be adverse to learning how to create these on my own (without someone else's code), but I'm not entirely sure where to start. Graphics and drawing aren't exactly my strongest suits.
Thank you for your time.
-Anfai
|
|
|
|
|
If you got the code from an article, then there is a "new message" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Ah, I understand. I wasn't intending my question to be solely for the creator of the article, as the article is now nearly nine years old. I will, however, post my inquiry there and hope for a response. Thank you for directing me to the correct location.
|
|
|
|