Windows Phone Developers

Saturday, June 19, 2010

How to Display WebPage Title on Windows Form using C#/.NET

Change Windows Form Caption dynamically using C#/VB.NET to display WebPage Title

It is good to display Webpage title on the userform  or any other control that hosts Webbrowser. This ressembles the functionaliy of Internet Explorer. The following code does the same:

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {

            this.Text = webBrowser1.Document.Title;
        }




The code uses DocumentCompleted event to update the WinForm's caption. Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Wednesday, June 16, 2010

How to Browse WebPages using WinForm

How to use WebControl in Windows Forms

WebBrowser control can be used to display Webpages on userform. Add a webbrowser control to the userform


Default page can be set used the URL property. Here I have set URL property to bing.com


WebBrowser Control and Userform

The same can be set through code using:

webBrowser1.Navigate("http://www.bing.com");

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Friday, June 11, 2010

C# Color Code and RGB Values / VB.NET Color Code and RGB Values

Color Name  RGB Value 
RGB Value of  AliceBlue  #F0F8FF 
RGB Value of  AntiqueWhite  #FAEBD7 
RGB Value of  Aqua  #00FFFF 
RGB Value of  Aquamarine  #7FFFD4 
RGB Value of  Azure  #F0FFFF 
RGB Value of  Beige  #F5F5DC 
RGB Value of  Bisque  #FFE4C4 
RGB Value of  Black  #000000 
RGB Value of  BlanchedAlmond  #FFEBCD 
RGB Value of  Blue  #0000FF 
RGB Value of  BlueViolet  #8A2BE2 
RGB Value of  Brown  #A52A2A 
RGB Value of  BurlyWood  #DEB887 
RGB Value of  CadetBlue  #5F9EA0 
RGB Value of  Chartreuse  #7FFF00 
RGB Value of  Chocolate  #D2691E 
RGB Value of  Coral  #FF7F50 
RGB Value of  CornflowerBlue  #6495ED 
RGB Value of  Cornsilk  #FFF8DC 
RGB Value of  Crimson  #DC143C 
RGB Value of  Cyan  #00FFFF 
RGB Value of  DarkBlue  #00008B 
RGB Value of  DarkCyan  #008B8B 
RGB Value of  DarkGoldenrod  #B8860B 
RGB Value of  DarkGray / DarkGrey†  #A9A9A9 
RGB Value of  DarkGreen  #006400 
RGB Value of  DarkKhaki  #BDB76B 
RGB Value of  DarkMagenta  #8B008B 
RGB Value of  DarkOliveGreen  #556B2F 
RGB Value of  DarkOrange  #FF8C00 
RGB Value of  DarkOrchid  #9932CC 
RGB Value of  DarkRed  #8B0000 
RGB Value of  DarkSalmon  #E9967A 
RGB Value of  DarkSeaGreen  #8FBC8F 
RGB Value of  DarkSlateBlue  #483D8B 
RGB Value of  DarkSlateGray / DarkSlateGrey†  #2F4F4F 
RGB Value of  DarkTurquoise  #00CED1 
RGB Value of  DarkViolet  #9400D3 
RGB Value of  DeepPink  #FF1493 
RGB Value of  DeepSkyBlue  #00BFFF 
RGB Value of  DimGray / DimGrey†  #696969 
RGB Value of  DodgerBlue  #1E90FF 
RGB Value of  FireBrick  #B22222 
RGB Value of  FloralWhite  #FFFAF0 
RGB Value of  ForestGreen  #228B22 
RGB Value of  Fuchsia  #FF00FF 
RGB Value of  Gainsboro  #DCDCDC 
RGB Value of  GhostWhite  #F8F8FF 
RGB Value of  Gold  #FFD700 
RGB Value of  Goldenrod  #DAA520 
RGB Value of  Gray / Grey†  #808080 
RGB Value of  Green  #008000 
RGB Value of  GreenYellow  #ADFF2F 
RGB Value of  Honeydew  #F0FFF0 
RGB Value of  HotPink  #FF69B4 
RGB Value of  IndianRed  #CD5C5C 
RGB Value of  Indigo  #4B0082 
RGB Value of  Ivory  #FFFFF0 
RGB Value of  Khaki  #F0E68C 
RGB Value of  Lavender  #E6E6FA 
RGB Value of  LavenderBlush  #FFF0F5 
RGB Value of  LawnGreen  #7CFC00 
RGB Value of  LemonChiffon  #FFFACD 
RGB Value of  LightBlue  #ADD8E6 
RGB Value of  LightCoral  #F08080 
RGB Value of  LightCyan  #E0FFFF 
RGB Value of  LightGoldenrodYellow  #FAFAD2 
RGB Value of  LightGreen  #90EE90 
RGB Value of  LightGray† / LightGrey  #D3D3D3 
RGB Value of  LightPink  #FFB6C1 
RGB Value of  LightSalmon  #FFA07A 
RGB Value of  LightSeaGreen  #20B2AA 
RGB Value of  LightSkyBlue  #87CEFA 
RGB Value of  LightSlateGray / LightSlateGrey†  #778899 
RGB Value of  LightSteelBlue  #B0C4DE 
RGB Value of  LightYellow  #FFFFE0 
RGB Value of  Lime  #00FF00 
RGB Value of  LimeGreen  #32CD32 
RGB Value of  Linen  #FAF0E6 
RGB Value of  Magenta  #FF00FF 
RGB Value of  Maroon  #800000 
RGB Value of  MediumAquamarine  #66CDAA 
RGB Value of  MediumBlue  #0000CD 
RGB Value of  MediumOrchid  #BA55D3 
RGB Value of  MediumPurple  #9370DB 
RGB Value of  MediumSeaGreen  #3CB371 
RGB Value of  MediumSlateBlue  #7B68EE 
RGB Value of  MediumSpringGreen  #00FA9A 
RGB Value of  MediumTurquoise  #48D1CC 
RGB Value of  MediumVioletRed  #C71585 
RGB Value of  MidnightBlue  #191970 
RGB Value of  MintCream  #F5FFFA 
RGB Value of  MistyRose  #FFE4E1 
RGB Value of  Moccasin  #FFE4B5 
RGB Value of  NavajoWhite  #FFDEAD 
RGB Value of  Navy  #000080 
RGB Value of  OldLace  #FDF5E6 
RGB Value of  Olive  #808000 
RGB Value of  OliveDrab  #6B8E23 
RGB Value of  Orange  #FFA500 
RGB Value of  OrangeRed  #FF4500 
RGB Value of  Orchid  #DA70D6 
RGB Value of  PaleGoldenrod  #EEE8AA 
RGB Value of  PaleGreen  #98FB98 
RGB Value of  PaleTurquoise  #AFEEEE 
RGB Value of  PaleVioletRed  #DB7093 
RGB Value of  PapayaWhip  #FFEFD5 
RGB Value of  PeachPuff  #FFDAB9 
RGB Value of  Peru  #CD853F 
RGB Value of  Pink  #FFC0CB 
RGB Value of  Plum  #DDA0DD 
RGB Value of  PowderBlue  #B0E0E6 
RGB Value of  Purple  #800080 
RGB Value of  Red  #FF0000 
RGB Value of  RosyBrown  #BC8F8F 
RGB Value of  RoyalBlue  #4169E1 
RGB Value of  SaddleBrown  #8B4513 
RGB Value of  Salmon  #FA8072 
RGB Value of  SandyBrown  #F4A460 
RGB Value of  SeaGreen  #2E8B57 
RGB Value of  Seashell  #FFF5EE 
RGB Value of  Sienna  #A0522D 
RGB Value of  Silver  #C0C0C0 
RGB Value of  SkyBlue  #87CEEB 
RGB Value of  SlateBlue  #6A5ACD 
RGB Value of  SlateGray / SlateGrey†  #708090 
RGB Value of  Snow  #FFFAFA 
RGB Value of  SpringGreen  #00FF7F 
RGB Value of  SteelBlue  #4682B4 
RGB Value of  Tan  #D2B48C 
RGB Value of  Teal  #008080 
RGB Value of  Thistle  #D8BFD8 
RGB Value of  Tomato  #FF6347 
RGB Value of  Turquoise  #40E0D0 
RGB Value of  Violet  #EE82EE 
RGB Value of  Wheat  #F5DEB3 
RGB Value of  White  #FFFFFF 
RGB Value of  WhiteSmoke  #F5F5F5 
RGB Value of  Yellow  #FFFF00 
RGB Value of  YellowGreen  #9ACD32 
Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Event Handler to Handle Multiple Events (C#/.NET)

Event handlers are of great use especially in WinForms programming. There might be a case where you will be having multiple Objects (Buttons for example), which requires to fire events of same type

The following snippet shows how to declare an eventhandler and assign it to multiple events


private void btn_Click(object sender, EventArgs e)
        {
            Button b1;
            b1 =  (System.Windows.Forms.Button)sender;
            MessageBox.Show("Button Clicked := " + b1.Name.ToString());
            b1.ForeColor = Color.Red;
        }

The above event handler is a generic one. It contains two arguments the sender, which contains the object that fired the event and Arguments.

Statement
b1 = (System.Windows.Forms.Button)sender;

Assigns (or casts) the object to button object. If casting is not done Cannot implicitly convert type 'object' to 'System.Windows.Forms.Button'. An explicit conversion exists (are you missing a cast?) is thrown

The snippet below assigns the sub - btn_Click with click events of both buttons

button1.Click += new EventHandler(btn_Click); 
           button2.Click += new EventHandler(btn_Click);
Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Thursday, June 10, 2010

Could not find type 'WindowsFormsControlLibrary1.UserControl1

Could not find type 'WindowsFormsControlLibrary1.UserControl1'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

What is solution for - "Visual Studio has encountered an exception. This may be caused by an extension."

---------------------------
Microsoft Visual Studio
---------------------------
Visual Studio has encountered an exception. This may be caused by an extension.



You can get more information by running the application together with the /log parameter on the command line, and then examining the file 'C:\Users\comp\AppData\Roaming\Microsoft\VisualStudio\10.0\ActivityLog.xml'.

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Wednesday, June 9, 2010

User Controls not showing up in the toolbox / New usercontrol not appearing in toolbox

User Control Will Not Appear In Toolbox / User Control not listed in toolbox


Here is a method to add UserControl manually to the toolbox:

Step 1: Right Click on ToolBox and select Choose Items


Step 2: Choose the ToolBox items you want to display. If your Usercontrol is not listed in Toolbox then Browse for the DLL and enable the checkbox

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Monday, June 7, 2010

How to make ActiveX control to interact with COM Object

How to make ActiveX control to expose COM Object

The Register for COM interop Checkbox indicates that your managed application will expose a COM object (a COM callable wrapper) that allows a COM object to interact with your managed application.


The Output type property in the Application page of the Project Designer for this application must be set to Class Library in order for the Register for COM interop property to be available.

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

kbAlertz.com :: Visual Studio 2005

kbAlertz.com :: Visual Studio 2008

kbAlertz.com :: Visual Basic 2005