Code Snippet RW (Response.Write)

יום ראשון, מאי 4, 2008

Code Snippet For Response.Write   Ok, this code snippet must be the oldest trick in the book, but still I think it will help to developers how doesn't know about it.   1. Create a file name rw.snippet 2. Copy this XML code and save it. 3. From the tools menu in VS, select "Code Snippets manager". 4. Select import, and point it to the saved file. 5. To use the snippet write rw in the code editor. 6. Enjoy!   <?xml version="1.0" encoding="utf-8" ?> ...
2 תגובות

CompositeControl or WebControl

יום שני, פברואר 11, 2008

Whenever possible, i rather to use UserControl instead of WebControl, since WebControls are more complicate to create and later on to maintain. But in case that i have to build a WebControl, i rather build a CompositeControl. Way CompositeControl? CompositeControl eventually inherit from WebControl, but each control inside the CompositeControl manage its own life cycle events and the ViewState / PostBack data. This means that we going to save a lots of code writing by not handling this events our self's. Implementing the CompositeControl Create the following code in a new Class Library: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace BaseType.Composite.Controls { public class...
3 תגובות

Visual Studio 2005 Recent Projects Manager

יום ראשון, אוקטובר 14, 2007

I didn't find a way to delete projects from my Recent Projects List in visual studio 2005, so I made this Add-In to manage them.   Place the 2 files in the (Attached) into the Add-In folder: MyDocuments\Visual Studio 2005\Addins   Load the visual studio, click "Tools" and then "Recent Projects Manager"   Please let me know about any problems you encountered:
תגיות: , , ,
אין תגובות

C# IRC Client API

יום ראשון, אוקטובר 7, 2007

Here is a little IRC API that I wrote allows you to connect to IRC server easily. The syntax to create the IrcClient is: 1: //Set the server details 2: ServerInfo serverInfo = new ServerInfo("", 6667, "GiladBot", "Gilad C# Bot", "", "#test"); 3:   4: //Create a IrcClient 5: IrcClient ircClient = IrcClientFactory.CreateIrcClient(serverInfo); 6:   7: //Subscribe to the irc server events 8: ircClient.OnServerText += new ServerTextHandler(ircClient_OnServerText); 9: ircClient.OnConnect += new ConnectHandler(ircClient_OnConnect); 10: ircClient.OnDataSend += new DataSendHandler(ircClient_OnDataSend); 11: ircClient.OnDisconnect += new...
תגיות: , ,
7 תגובות

Cool trick with TAB in Visual Studio for auto completing code blocks

יום שלישי, יולי 17, 2007

I found a cool trick for auto completing some code blocks. Personally, I find it very convenient while i'm in hyperspace speed coding. Its called snippets and its built-in in Visual Studio, and you can create one yoursefe. When you start a new "try" block, after finishing to write "try", immediately press TAB button, it will auto complete to:try { } catch (Exception) { throw; } When you start a new condition block, "if (2 > 1)", and after you add the "else" condition, after finishing to write "else", immediately press TAB button, it will auto complete to:if (2 > 1) { } else { }
תגיות: , , ,
2 תגובות

Visual Studio shortcuts keys

יום ראשון, יולי 15, 2007

You 2 can become a visual studio shotrcut keys GURU ! Mister Miagi once said: Rule number one, breathe in and... breathe out ! Rule number two, first learn rule number one...
תגיות: , ,
אין תגובות

Transform an XML to HTML – StringReader

יום שני, יוני 11, 2007

Here is a great way to transform an XML string returned from DB Query to a HTML using DataGrid/List... The xml represent by the StringReader, witch implements a TextReader that reads from a string. Then loaded to DataSet (by ds.ReadXML), and finally binds to the DataGrid. //Supposed this is the text returning from DB... string xml = "<rows><row id='1'><name>Gilad</name><address>Burla</address>" + "<country>Israel</country></row><row id='2'><name>John</name>" + "<address>Igaal Alon</address><country>Israel</country></row></rows>"; using (StringReader reader = new StringReader(xml)) { DataSet ds = new...
אין תגובות