Click here to Skip to main content
15,911,139 members
Home / Discussions / C#
   

C#

 
Questioncode for IP detection on LAN Pin
mitesh4879-Mar-09 22:12
mitesh4879-Mar-09 22:12 
AnswerRe: code for IP detection on LAN Pin
NeCroFire9-Mar-09 22:26
NeCroFire9-Mar-09 22:26 
AnswerRe: code for IP detection on LAN Pin
Jack Li9-Mar-09 22:45
Jack Li9-Mar-09 22:45 
GeneralRe: code for IP detection on LAN Pin
Mycroft Holmes9-Mar-09 23:37
professionalMycroft Holmes9-Mar-09 23:37 
GeneralRe: code for IP detection on LAN Pin
dan!sh 9-Mar-09 23:46
professional dan!sh 9-Mar-09 23:46 
AnswerRe: code for IP detection on LAN Pin
dan!sh 9-Mar-09 23:28
professional dan!sh 9-Mar-09 23:28 
GeneralRe: code for IP detection on LAN Pin
EliottA10-Mar-09 3:16
EliottA10-Mar-09 3:16 
QuestionListView in C# Pin
mrithula89-Mar-09 22:02
mrithula89-Mar-09 22:02 
Hi Can you tel me what does this error signify?
'ListView.Form1' already defines a member called 'InitializeComponent' with the same parameter types
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace ListView
{
    public partial class Form1 : Form
    {
        XmlTextReader reader;
        XmlDocument doc = new XmlDocument();
        StringCollection foldercol = new StringCollection();
        ImageList ilLarge = new ImageList();
        ImageList ilSmall = new ImageList();
        private System.Windows.Forms.ListView list = new System.Windows.Forms.ListView();
        Label lbl = new Label();
        Button b = new Button();
       
        public Form1()
        {
            InitializeComponent();
            CreateHeadersAndFillListView();
            String sss;
            PaintListView(sss);   
        }

        private void InitializeComponent()
        {
            button1.Click += new EventHandler(button1_Click);
            // list.ItemActivate += new EventHandler(list_ItemActivate);

        }

        private void CreateHeadersAndFillListView()
        {
            ColumnHeader colHead;

            colHead = new ColumnHeader();
            colHead.Text = "Filename";
            this.list.Columns.Add(colHead);

            colHead = new ColumnHeader();
            colHead.Text = "Size";
            this.list.Columns.Add(colHead);

            colHead = new ColumnHeader();
            colHead.Text = "Last accessed";
            this.list.Columns.Add(colHead);
        }

        private void PaintListView(string sss)
        {
            try
            {
                ListViewItem lvi;
                ListViewItem.ListViewSubItem lvsi;

                this.lbl.Text = sss + "(Double click to display the path name)";
                //DirectoryInfo dir = new System.IO.DirectoryInfo(root);
                //DirectoryInfo[] dirs = dir.GetDirectories();
                //FileInfo[] files = dir.GetFiles();

                this.list.Items.Clear();
                this.list.BeginUpdate();

                reader = new XmlTextReader("path.xml");
                Form1 f = new Form1();
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Text: //Display the text in each element.
                            //   Console.WriteLine(reader.Value);
                            String s1;
                            s1 = reader.Value;
                            String ss;
                            ss = listBox1.SelectedItem.ToString();
                            sss = ss + s1;
                            object o3 = (object)sss;

                            DirectoryInfo dire = new DirectoryInfo(sss);
                            if (dire.Exists)
                            {
                                String[] folder;
                                folder = Directory.GetDirectories(sss);
                                foreach (string foldername in folder)
                                {
                                    DirectoryInfo di = new DirectoryInfo(foldername);
                                    if (di.Exists)
                                    {
                                        String[] files;
                                        files = Directory.GetFiles(foldername);
                                        foreach (String filename in files)
                                        {
                                            FileInfo fil2 = new FileInfo(filename);
                                            lvi = new ListViewItem();
                                            lvi.Text = fil2.Name;
                                            lvi.ImageIndex = 1;
                                            lvi.Tag = fil2.FullName;

                                            lvsi = new ListViewItem.ListViewSubItem();
                                            lvsi.Text = fil2.Length.ToString();
                                            lvi.SubItems.Add(lvsi);

                                            lvsi = new ListViewItem.ListViewSubItem();
                                            lvsi.Text = fil2.LastAccessTime.ToString();
                                            lvi.SubItems.Add(lvsi);

                                            this.list.Items.Add(lvi);
                                            // listBox5.Items.Add(fil2.ToString());
                                        }
                                        this.list.EndUpdate();
                                    }
                                }
                            }

                            break;
                    }
                }

            }
            catch (Exception err)
            {
                MessageBox.Show("Error: " + err.Message);
            }

            this.list.View = View.Details;
        }


        private void button1_Click(object sender, EventArgs e)
        {
            //listBox1 lb = (listBox1)sender;
            string[] drives = Environment.GetLogicalDrives();
            // Loop into the string array
            foreach (string strDrive in drives)
            {
                // Add items (drives) to the list
                listBox1.Items.Add(strDrive.ToString());
            }
        }
    }
}

AnswerRe: ListView in C# Pin
MumbleB9-Mar-09 22:11
MumbleB9-Mar-09 22:11 
AnswerRe: ListView in C# Pin
Xmen Real 9-Mar-09 23:42
professional Xmen Real 9-Mar-09 23:42 
QuestionExcel Questions [modified] Pin
MumbleB9-Mar-09 21:43
MumbleB9-Mar-09 21:43 
AnswerRe: Excel Questions Pin
Mycroft Holmes9-Mar-09 23:44
professionalMycroft Holmes9-Mar-09 23:44 
GeneralRe: Excel Questions Pin
MumbleB10-Mar-09 0:43
MumbleB10-Mar-09 0:43 
Questionexcel addin doubt Pin
abhiram_nayan9-Mar-09 21:37
abhiram_nayan9-Mar-09 21:37 
Questionhow to delay sending mail in c# Pin
Ramin Rahimee9-Mar-09 21:23
Ramin Rahimee9-Mar-09 21:23 
AnswerRe: how to delay sending mail in c# Pin
Mycroft Holmes9-Mar-09 21:27
professionalMycroft Holmes9-Mar-09 21:27 
GeneralRe: how to delay sending mail in c# Pin
Ramin Rahimee9-Mar-09 21:35
Ramin Rahimee9-Mar-09 21:35 
GeneralRe: how to delay sending mail in c# Pin
N a v a n e e t h9-Mar-09 21:47
N a v a n e e t h9-Mar-09 21:47 
GeneralRe: how to delay sending mail in c# Pin
Ramin Rahimee9-Mar-09 22:54
Ramin Rahimee9-Mar-09 22:54 
GeneralRe: how to delay sending mail in c# Pin
Christian Graus9-Mar-09 22:02
protectorChristian Graus9-Mar-09 22:02 
GeneralRe: how to delay sending mail in c# Pin
Ramin Rahimee9-Mar-09 22:52
Ramin Rahimee9-Mar-09 22:52 
GeneralRe: how to delay sending mail in c# Pin
Dave Kreskowiak10-Mar-09 1:29
mveDave Kreskowiak10-Mar-09 1:29 
GeneralRe: how to delay sending mail in c# Pin
Rob Philpott9-Mar-09 23:14
Rob Philpott9-Mar-09 23:14 
GeneralRe: how to delay sending mail in c# Pin
Ramin Rahimee9-Mar-09 23:47
Ramin Rahimee9-Mar-09 23:47 
GeneralRe: how to delay sending mail in c# Pin
Mycroft Holmes9-Mar-09 23:26
professionalMycroft Holmes9-Mar-09 23:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.