Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

13 June 2014

Auto Complete TextBox in Window Form C#

Hi All,

Let see how to create the AutoComplete TextBox in window form.
You might be aware of Auto Complete in web page using the Ajax and JQuery plugins or using the asp.net ajax toolkit.

But when it comes to the Auto Complete TextBox in Window Form some people find it difficult.

I am gonna demonstrate you Auto Complete Textbox for months Jan - Dec.

Download Sample
  • Open Visual Studio and create a Window Form application. 
  • It will add a blank default Window Form for you.
  • Drag a label name it Months and a Input TexBox for Auto Complete Months.

  • Double Click form to open Form_Load event. and create AutoCompleteStringCollection class object.
  • Add you indented string item in object in this case months name string array.
        private void Form1_Load(object sender, EventArgs e)
        {            
            // Create the list to use as the custom source.  
            var source = new AutoCompleteStringCollection();            
            source.AddRange(new string[]
                    {
                        "January",
                        "February",
                        "March",
                        "April",
                        "May",
                        "June",
                        "July",
                        "August",
                        "September",
                        "October",
                        "November",
                        "December"
                    });
            
            // attched it with the created text box.
            textBox1.AutoCompleteCustomSource = source;
            textBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
        }

  • Bind the AutoCompleteStringCollection with textBox1.

and you are done.  Now when you run the form and just type only one character "j" it will show the months starting from "j".

Happy knowledge sharing.. ☺

11 September 2013

IIS7 : An error occurred on the server when processing the URL. Please contact the system administrator

Hello Friends,

If you have worked with Classic ASP with IIS5 or IIS6, that is easy to recognize the error occurred in code.  IIS send the error information to client which show the file name, line no. and other information to understand where and what error occurred.  But now a days if you use IIS7 and trying to publish your classic ASP web application in IIS7, you may see a message like -

An error occurred on the server when processing the URL. Please contact the system administrator

After investigating a bit here and there I find out because scriptErrorSentToBrowser by default is false in IIS7 so we are unable to get the proper error message.  We need to change the default value(false) to true for the scriptErrorSentToBrowser flag in IIS7. Here is how to change it -

Open your cmd prompt "As Administrator" and run the following command -

%windir%\system32\inetsrv\appcmd set config -section:asp -scriptErrorSentToBrowser:true

now you'll be able to see the proper error message. I would suggest you to set the flag to false after debugging because sometimes it shows very critical imp details to end user that can be harmful. You can use the same command just replace the 'true' by 'false'

%windir%\system32\inetsrv\appcmd set config -section:asp -scriptErrorSentToBrowser:false

Happy knowledge sharing.. :)