.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Really weird MessageBox behaviour

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :Windows Application
I encountered some really weird behaviour with a MessageBox. As mine was a big complex app I thought it could be some complex problem, so I created a really simple app to test the problem, and it is still there. I really do not unstand this behaviour...can anybody explain it to me!

The simple app that demonstrates the problem is shown below. It is just an empty form with a single timer. The timer event handler invokes a message box. Now I would expect the message box to have modal behaviour, and thus block any further event callbacks until the dialog is closed. But it didn't, each time the handler is called, a new MessageBox was shown...that's why I added the if(TimerTicks<5) condition ;-)

So at that point I assumed that MessageBox is behaving in a non modal manner for some reason, creating new instances without waiting for button press before returning, and set a breakpoint following the show call to test this (i.e. a breakpoint on 'object foo=res').

What I found was that this line gets called **after** a dilaog button is pressed, despite the fact that the timer event handler continues to be called at each interval timeout. Whatsmore it gets called every time a dialog is closed, independently from the regular execution of the handler.

The only way

View Complete Post

More Related Resource Links

Weird behaviour of Gridview with textbox with autopostback OnTextChanged and AJAX CalendarExtender

I ran in to some strange behaviour of Gridview with textbox with autopostback OnTextChanged and AJAX CalendarExtender. This gridview is in an updatepanel with scriptmanager. When my gridview is filled with data, it keeps running my OnTextChanged  function and therefor makes my application terribly slow. I need to have the autopostback and ontextchanged function to recalculate stuff in my gridview. Does anybody know of this problem and if so does anybody found a workarround ?

Weird behaviour of XSLT webpart



I've setup an XSLT list view webpart to show data from an external list. I needed to set it up programmatically, so I also provided a link to a XSL file hosted on the same server.

In that XSL, I've provided a custom link to an entity action. Now the weird thing is: when I paste in the XSL between <Xsl></Xsl> in the web part page; that link works. When the exact same XSL is loaded from the hosted version though, SharePoint seems to replace the link by a default "show item" action.

What's causing this and how can I prevent it from doing this???

MCTS in Web Application Development in .NET 2.0

Bug/weird behaviour in HttpWebRequest corner case

If a response to a HttpWebRequest is "HTTP/1.1 204 No Content" AND (breaking the
standard) content is served, there will be no error. The next HttpWebRequest, 
provided it goes to the very same server will throw a 
"The server committed a protocol violation. Section=ResponseStatusLine"-exception
even though the request and response is valid.

This is not the case if the response is "HTTP/1.0" instead of "HTTP/1.1" and will
of course not happen if no content is provided.

It is my opinion that if an excpetion should be thrown, it should be done during the first response.

Here is an example (the first url-response is flaky, the second one is good, yet the second one failes):

static void Main(string[] args)

active directory exception unusual behaviour


i have a small problem
i want user names from active directory for an auto completer type of service
the method is always throwing an exception 
"searcher.FindAll()' threw an exception of type 'System.DirectoryServices.DirectoryServicesCOMException' System.DirectoryServices.SearchResultCollection 

Cutting Edge: Using Windows Hooks to Enhance MessageBox in .NET


It's fairly safe to assume that all programmers working in Windows® environments are familiar with MessageBox. The MessageBox function displays a message through a popup dialog box and lets programmers add dialog buttons and icons to the message to improve user feedback.

Dino Esposito

MSDN Magazine November 2002

Weird security configuration error message


Recently something has gone wrong with our website so that whenever you try to access an aspx file, it shows the following error:


Server Error in '/RALSWeb' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Access is denied: 'RalsWeb'.

Source Error:

Line 256:                <add assembly="System.EnterpriseServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 257:                <add assembly="System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 258:                <add assembly="*"/>
Line 259:            </assemblies>

the list.aspx bad behaviour


I have two tables : table1 (primary) and table2 with one to many relation .

table 1 has more than 130 000 records , table2 has near to 200 000 records .


when i am trying to list table2 , the table2/list.aspx will build filter depending on the relation.; this operation slows down the page (drop down list with 130 000 record)

 I disabled the filter by using the attribute AutoGenerateFilter = False .


now the problem is that table2/list.aspx?key=value will list all the recoreds in table 2 .


why is the page not using the query that is related to the parmeter passed to it ?


List.aspx (or list.aspx?key=value) will always get all the recorders from the table2  after disabling the key relation filter .

I want my table2/list.aspx?key=value  to query the table2 depending on the passed key which is the expected behaviour .

please advice .













Weird "string;#" in combobox


Ok, while I am digging and digging myself into the world that's called Sharepoint I come to the next challenge.


I have two lists Projects List and Project Issues. They both have an id field (which is not the ID field of the record) and a title. I created two calculated fields for both of the tables which combines the title and the number for displaying in other pages.



Projects List:

ProjectID: 2008-001

Project Name: First Project in 2008

Display Name (which is the calculated field): 2008-001 First Project in 2008


The calculated field formula is: =[ProjectID]&" "&[Project Name]

The field returns a string.


I also have a Worksheet list where my workers have to fill in their working hours. In this list I have two lookup fields. O

ASP.NET DateTime Conversion strange behaviour



I am working on ASP.NET web application where we are using javascript calendar to accept the date in textboxes. The date format is dd/mm/yyyy. The application is running in US and UK environments.

I am facing issues in US environment while storing the dates so I have added 2 keys in config file viz culture which will be either en-US or en-GB depending on the deployment location and baseCulture which will always be en-GB.

In the code, I have added a condition which checks if culture and baseCulture values are not matching then do the conversion of date in US format.

But I have found that the code converts the date from dd/mm/yyyy to mm/dd/yyyy when the key is baseCulture (en-GB) and it throws FormatException when key is culture (en-US).

I am bit confused by this behaviour. Is this normal? Can any one please explain more about this? Note: I am working on a machine which has en-US as language and culture

<add key="culture" value="en-US" />
<add key="baseCulture" value="en-GB" />
// This line works and converts the date from 26/08/2010 to 08/26/2010
// Here the baseCulture is en-GB.
DateTime dt = DateTime.Parse(txtCurrentDate,baseCulture)

// This line throws FormatException. culture 

MessageBox or?


Hi guys. I have textboxes about First Name and Last name and i have button called submit that insert the information from the textboxes in my database. All working fine but i want when a record( only one is possible at time) is been added to the DB to show up a message box or something like that( but i don't want a label and i will tell you why) that say record has been add successfully( i don't think those box need a button like Ok or something like that only text). Of course it can display info like Problem occurs with inserting a record. Now i want when the box show the same to disappear when user click on one of the boxes( this mean if he/she want to add another resident in my DB) or to disappear after 5 seconds or something like that?

Weird problem in Detailsview - Dropdownlist in



I'm new in this forum and I really hope you'll be able to help me.

I converted a field in the detailsview into a template field and put a dropdownlist in the <InsertItemTemplate> and it worked great. This is the code I put:

<InsertItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre"  DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></InsertItemTemplate>

Now, I tried to do the same thing for the <EditItemTemplate> . This is the code I put there:

<EditItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre" DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></EditItemTemplate>  

When I change the DV properties I do see that a dropdownlist was  added but when I run the program and click on "Edit" in the DV nothing happens (however when I click on "Insert" it works fine).

This is the Select command for the data source I used:

<asp:SqlDataSource runat="server"

IE 7 Weird error


NOTE: In firefox or Chrome not an issue, but in IE it just has become one.


<span  id="titleGannAngles" runat="server" >Title goes here</span>

Javascript global variable

var ogannangles = '<%= titleGannAngles.ClientID %>';

Js code in a function

document.getElementById(ogannangles).innerHTML="Object: Gann Angle,Grid,Arcs"+des;

It renders like this:      document.getElementById('ctl00_ContentPlaceHolder1_Chart_Volume1_Chart_Objects_Settings1_Chart_Objects_Edit1_titleGannAngles').innerHTML="Object: Gann Angle,Grid,Arcs"+des;

YET IE 7 gives me the error on this line:

document.getElementById(ogannangles).innerHTML="Object: Gann Angle,Grid,Arcs"+des;

That object is NULL or not an object ???

Why ???

binary serialize weird error

i got this class, when i wanna serialize it, i keep getting error System.Runtime.Serialization.SerializationException was unhandled by user code   Message=Type 'System.Linq.Enumerable+WhereSelectListIterator`2[[Data.Models],[System.Int32, mscorlib, Version=, ...' in Assembly 'System.Core, Version=, ... is not marked as serializable. [Serializable] public class XXX : ... { public IEnumerable<int> CardFilters { get; set; } //public void RequeryCardFilters() //{ //} public void RequeryCardFilters() { this.CardFilters = null; ... //IEnumerable<Data.Models> var rslt = RFDataViewModelFactory.GetReportCardFilters(this.Identifiers, this.PostcodeFrom, this.PostcodeTo, this.LastContactBefore, this.RecontactBy, this.SelectedCardType); ... IEnumerable<int> rsltIds = from i in rslt select i.Id; } } you can see inside the RequeryCardFilters(), i only play with 3 data/var, 1 of them is local public prop, the other 2 are local var. If you remark this out, and just use an empty method, it worked fine. what can cause the serialization to fail? IFormatter formatter = new BinaryFormatter(); MemoryStream memStrem = new MemoryStream(); formatter.Serialize(memStrem, myObj);

weird problem of using multithread to querying sql server

Hi,   I'm working on a project which needs query the sql server many times to pull the statistics info. the whole process is very slow. so, I'm trying to use the multithread to do the work. However, I noticed one weird thing:   In the program, I need pull, say 10000 documents from the sql to local PC, then can do some analysis. Each document size is different. If I used 1 thread, say for document A whose size is 5MB, it will take about 20 seconds for the SELECT query returns the result. Now, if I used 10 threads, I found that it will take much longer time for SQL to return the SELECT query for document A, say maybe 90 seconds. I got the run time for the SELECT from the sql profiler.   Overall, the performance of multithread is very similar to single thread even I use 50 threads. I used the same code for another project, the only difference is that that project scrapes data from website and this project gets data from sql. The other project works very well when using multithread. so, I'm kind of believe that the multithread part code works fine.    Could this because some settings on sql server? some bandwidth limitation? any clues?   any help/suggestion will be appreciated.   thanks reader      

How to Prevent the expand/collapse behaviour of my Custom Activity?

  How can I prevent the expand feature of my custom activity with custom designer ? I have custom WF4 activities with Custom designers. These activities are not container activities. I just want to prevent the expand feature of the same; just like Assign activity. I set the Collapsible attribute of teh ActivityDesigner false; but still it is expanding to the next level. Thanks AmbilyIT Analyst

Background window failed to update after MessageBox was closed on 64-bit Windows7

In vs2008, I open a WPF window as background, and then click a button in background window to open the second window. In the second window, I make it WindowStartupLocation CenterScreen and put some controls, and then click a button in the second window to close it and open a messagebox, after closing the messagebox, I find the area behind the messagebox always fails to update in the background window. code of the buttonclick from the second window: this.close(); messagebox.show("*********************")  // after closing the messagebox, the area behind it in the backgound window always fails to update. This issue can only be reproduced in 64-bit windows7 Anyone got idea? Thanks in advance. bruce

VERY strange behaviour of IE7 and 8!

Today is a day where nothing seems to work out as expected.I'm currently making the HTML and Javascript templates for our new Corporate Page.The thing works as expected in Firefox, Opera, Chrome and IE 6, but not in IE 7 and 8!The "thing" is a menu/submenu written by me in javascript.The way it looks in Firefox etc:The way it looks in IE 7 and 8:There is absolutely no explanation for the strange "rounded" edge on the right and the gradient going over it.The background is a semi-transparent optimized PNG without color profiles which shows up gray in IE 6 and transparent in the other browsers - as expected.On my other developer's computer, it shows up perfectly in both IE 7 and 8.What could possibly create this behaviour?----source:<div class="subMenusContainer"> <div class="subMenu" id="aboutUsMenu"> <a href="/Home/AboutAurora">About AURORA</a> <a href="/Home/AboutErichKrammer">Erich Krammer</a> <a href="/Home/AboutFoundation">AURORA Foundation</a> <a href="/Home/AboutPartners">Partners</a> <a href="/Home/AboutCareers">Careers</a> <a href="/Home/AboutContact">Contacts</a> </div> [snip] <div class="subMenu&q
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend