some useful thing on events and delegates...
//Declare a delegate (class member)
private delegate void UpdateProgressBar();
//Create an instance of the delegate for us to use (class member)
private UpdateProgressBar updateProgressDelegate;
void StepProgressBar()
{
progressBar.PerformStep();
}
//Method executed on a different thread
DoDatabaseUpdate()
{
//Associate a method to our delegate (defined above)
updateProgressDelegate = new UpdateProgressBar(StepProgressBar);
for (;;) //Some loop
{
//Code for the lengthy operation
...
...
this.Invoke(updateProgressDelegate );//Update the progress bar by calling the delegate
}
}
Thursday, December 3, 2009
Monday, November 23, 2009
UI looks different on different PC's
Do you know in Winform (.net 2.0) UI can look different on different resolutions and DPI settings. Useful link below
http://stackoverflow.com/questions/185804/how-to-control-the-font-dpi-in-net-winforms-app
http://stackoverflow.com/questions/185804/how-to-control-the-font-dpi-in-net-winforms-app
Friday, November 20, 2009
subversin control in visual stuido : step by step guide
a nice article on how to set subversion in visual studio
http://www.west-wind.com/presentations/subversion/
http://www.codeproject.com/KB/dotnet/SourceControl_VSNET.aspx
http://www.west-wind.com/presentations/subversion/
http://www.codeproject.com/KB/dotnet/SourceControl_VSNET.aspx
Monday, November 16, 2009
good sql server utility
some good ms-sql related utilities are as follows
1) Microsoft SQL Server Management Studio Express
http://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en
2) Sql Script builder > with this you can export both structure and data in a script file.
3) Microsoft sql data publishing...
1) Microsoft SQL Server Management Studio Express
http://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en
2) Sql Script builder > with this you can export both structure and data in a script file.
3) Microsoft sql data publishing...
windows forms timer
there are following types of Timers available in c#
1 vote down star
System.Threading.Timer,
System.Timers.Timer, and
System.Windows.Forms.Timer
and in some cases using one in place of another helps sometimes. :-)
1 vote down star
System.Threading.Timer,
System.Timers.Timer, and
System.Windows.Forms.Timer
and in some cases using one in place of another helps sometimes. :-)
Wednesday, November 11, 2009
Tuesday, November 10, 2009
assembly location might change
there are times when assemble you reference changes to local copy, so always check the location of the assebly being reference (version etc) in the REFERENCE section of visual studio. I once had to debug for half day for this silly issue :-)
what to do when long running threads don't respond
Additional Information: The CLR has been unable to transition from COM
context 0x189558 to COM context 0x189408 for 60 seconds. The thread
that owns the destination context/apartment is most likely either doing
a non pumping wait or processing a very long running operation without
pumping Windows messages. This situation generally has a negative
performance impact and may even lead to the application becoming non
responsive or memory usage accumulating continually over time. To avoid
this problem, all single threaded apartment (STA) threads should use
pumping wait primitives (such as CoWaitForMultipleHandles) and
routinely pump messages during long running operations.
=======================
One simple remedy is the following
there are 2 things to try
1. goto "Debug", "Exceptions..." menu
2. Managed Debugging Assistants, uncheck ContextSwitchDeadlock
Or you can try following
=============================
Call routinely CurrentThread->Join(0), this implicitely calls
CoWaitForMultipleHandles and returns.
Thanks willy, this is working and pumping message.
But on my form, i have a label and a progress bar.
During this time, the progress bar is refreshed, but not the label.
Should i call an explicit update ?
This is my code :
this->Show();
this->Update();
for each(entry in entries)
{
TreatmentForOneOr2Secs();
this->progressBar1->PerformStep();
System::Threading::Thread::CurrentThread->Join(0);
}
this->Hide();
("this" is the form)
Do you know why the label isn't refreshed ?
context 0x189558 to COM context 0x189408 for 60 seconds. The thread
that owns the destination context/apartment is most likely either doing
a non pumping wait or processing a very long running operation without
pumping Windows messages. This situation generally has a negative
performance impact and may even lead to the application becoming non
responsive or memory usage accumulating continually over time. To avoid
this problem, all single threaded apartment (STA) threads should use
pumping wait primitives (such as CoWaitForMultipleHandles) and
routinely pump messages during long running operations.
=======================
One simple remedy is the following
there are 2 things to try
1. goto "Debug", "Exceptions..." menu
2. Managed Debugging Assistants, uncheck ContextSwitchDeadlock
Or you can try following
=============================
Call routinely CurrentThread->Join(0), this implicitely calls
CoWaitForMultipleHandles and returns.
Thanks willy, this is working and pumping message.
But on my form, i have a label and a progress bar.
During this time, the progress bar is refreshed, but not the label.
Should i call an explicit update ?
This is my code :
this->Show();
this->Update();
for each(entry in entries)
{
TreatmentForOneOr2Secs();
this->progressBar1->PerformStep();
System::Threading::Thread::CurrentThread->Join(0);
}
this->Hide();
("this" is the form)
Do you know why the label isn't refreshed ?
thread invoke
Know something
http://blogs.lessthandot.com/index.php/DesktopDev/MSTech/the-difference-between-invoke-and-begini
In short.
* Delegate.Invoke: Executes synchronously, on the same thread.
* Delegate.BeginInvoke: Executes asynchronously, on a threadpool thread.
* Control.Invoke: Executes on the UI thread, but calling thread waits for completion before continuing.
* Control.BeginInvoke: Executes on the UI thread, and calling thread doesn’t wait for completion.
http://blogs.lessthandot.com/index.php/DesktopDev/MSTech/the-difference-between-invoke-and-begini
In short.
* Delegate.Invoke: Executes synchronously, on the same thread.
* Delegate.BeginInvoke: Executes asynchronously, on a threadpool thread.
* Control.Invoke: Executes on the UI thread, but calling thread waits for completion before continuing.
* Control.BeginInvoke: Executes on the UI thread, and calling thread doesn’t wait for completion.
Monday, November 9, 2009
raymond blog, nice one
lovely computer blog site, keeps you updated on whats happening around and some nice offers too :-)
http://www.raymond.cc/
http://www.raymond.cc/
Sunday, November 8, 2009
maharashtra landline phone number tracking
want to track a landline phone number in maharashtra, try this link below
http://210.212.176.226/phonesearch.php
http://210.212.176.226/phonesearch.php
special characters
some special characters are as follows
special characters ~ ( ) # \ / = > < + - * % & | ^ ' " [ ],
special characters ~ ( ) # \ / = > < + - * % & | ^ ' " [ ],
Saturday, November 7, 2009
datatable row selection
there are various wasys of searching in a datatable
.select
foreach
.rows.Find
do you know which one is the best approach and in which circumstances
http://msdn.microsoft.com/en-us/library/dd364983.aspx
.select
foreach
.rows.Find
do you know which one is the best approach and in which circumstances
http://msdn.microsoft.com/en-us/library/dd364983.aspx
picturebox image setting properties
are you aware of various things about picturebox. Looks similar but there is some significant differences :-)
pictureBox1.ImageLocation
pictureBox1.Image
pictureBox1.LoadAsync
pictureBox1.Load
http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/22b05cc9-45d9-4a73-a199-2c56801d63f9
pictureBox1.ImageLocation
pictureBox1.Image
pictureBox1.LoadAsync
pictureBox1.Load
http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/22b05cc9-45d9-4a73-a199-2c56801d63f9
all about rowfilter
all about ROWFILTER
http://aspdotnetcodebook.blogspot.com/2008/07/short-tutorial-on-dataview-rowfilter.html
string rowFilterString = EscapeLikeValue(e.Argument.ToString());
public static string EscapeLikeValue(string valueWithoutWildcards)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < valueWithoutWildcards.Length; i++)
{
char c = valueWithoutWildcards[i];
if (c == '*' || c == '%' || c == '[' || c == ']')
sb.Append("[").Append(c).Append("]");
else if (c == '\'')
sb.Append("''");
else
sb.Append(c);
}
return sb.ToString();
}
http://aspdotnetcodebook.blogspot.com/2008/07/short-tutorial-on-dataview-rowfilter.html
string rowFilterString = EscapeLikeValue(e.Argument.ToString());
public static string EscapeLikeValue(string valueWithoutWildcards)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < valueWithoutWildcards.Length; i++)
{
char c = valueWithoutWildcards[i];
if (c == '*' || c == '%' || c == '[' || c == ']')
sb.Append("[").Append(c).Append("]");
else if (c == '\'')
sb.Append("''");
else
sb.Append(c);
}
return sb.ToString();
}
Sunday, February 1, 2009
google chart api illustrated
want to try some nice combinations before you use google charts api, here is a useful link
http://www.clabberhead.com/googlechartgenerator.html
http://www.clabberhead.com/googlechartgenerator.html
Saturday, January 31, 2009
datarepeater alternate for c# winform
try using Microsoft Visual Basic power pack 3.0 Datarepeater for an alternate of asp.net datarepeater for c# winforms. Its a nice alternate and every developer should have knowledge of it. For more details refer to the link below
http://msdn.microsoft.com/en-us/vbasic/bb735936.aspx
have fun coding :-)
http://www.machlibazar.com/blog/
http://www.machlibazar.com/blog/
http://msdn.microsoft.com/en-us/vbasic/bb735936.aspx
have fun coding :-)
http://www.machlibazar.com/blog/
http://www.machlibazar.com/blog/
Friday, January 2, 2009
xml exception
good link about illegal characters appearing in xml. System.XmlException issue
http://seattlesoftware.wordpress.com/2008/09/11/hexadecimal-value-0-is-an-invalid-character/
http://seattlesoftware.wordpress.com/2008/09/11/hexadecimal-value-0-is-an-invalid-character/
Subscribe to:
Posts (Atom)