Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have to write tis code in asp.net by using textbox,listbox and one button



C#
using System;
using System.Xml;

namespace ReadXMLfromFile
{
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    class Class1
    {
        static void Main(string[] args)
        {
            XmlTextReader reader = new XmlTextReader ("books.xml");
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element: // The node is an element.
                        Console.Write("<" + reader.Name);
                        Console.WriteLine(">");
                        break;
                    case XmlNodeType.Text: //Display the text in each element.
                        Console.WriteLine (reader.Value);
                        break;
                    case XmlNodeType.EndElement: //Display the end of the element.
                        Console.Write("</" + reader.Name);
                        Console.WriteLine(">");
                        break;
                }
            }
            Console.ReadLine();
        }
    }
}


[edit]Tags - OriginalGriff[/edit]
Posted
Updated 27-Feb-12 21:02pm
v2
Comments
jim lahey 28-Feb-12 2:45am    
Tell you what? What does this have to do with Android?
anusha 2 28-Feb-12 2:56am    
sorry sir i want to write in asp.net

1 solution

The you need to start with a different type of application.
That is a Console app - you need to start with a WinForms app.

1) Open a new instance of Visual Studio.
2) On the Start Page, click "New Project"
3) On the dialog that is displayed, select "C#", "Windows" on the left, and "Windows Forms Application" on the right.
4) Give it a sensible name, and press "OK"

You can now drag a TextBox, a ListBox and a Button onto your form.

Now, all you have to do is hook them up - but your lecture notes should cover that!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900