Member Avatar for nssltd

Hi i have been making a small login suite purely out of fun. i am using xml to record the passwords set by a user, i have coded most of it but i am baffeled by this error!
here is my work so far;

private void al(String password, string name)
        {
            XmlDocument myxml = new XmlDocument();
            XmlElement el = myxml.CreateElement("value");
            el.SetAttribute("password", password);
            el.InnerText = name;

            if (!File.Exists(pswXml))
            {
                XmlElement root = myxml.CreateElement("value");
                myxml.AppendChild(root);
                root.AppendChild(el);

            }
            else
            {

                myxml.Load(pswXml);
                myxml.DocumentElement.AppendChild(el);

            }

            if (panel1.Visible == true)
            {
                TreeNode node = new TreeNode();
                node.Name = el.GetAttribute("password");
                node.ToolTipText = el.GetAttribute("password");
                treeView1.Nodes[0].Nodes.Add(node);
            }
            myxml.Save(pswXml);
        }

        private void button1_Click(object sender,EventArgs e)
        {
            al();
        }

here are the imports i used

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using System.Collections;
using System.IO;
using System.Xml;
using System.Net;
using System.Diagnostics;
using System.Globalization;

also i declared these in the public part if this matters.

public static String pswXml = "psw.xml";
List<String> urls = new List<String>();
        XmlDocument settings = new XmlDocument();

and i get this error message for this part of the code

private void button1_Click(object sender,EventArgs e)
        {
            al();
        }
Error	1	No overload for method 'al' takes '0' arguments

Any help is much appreciated thanks!

Recommended Answers

All 2 Replies

The al() method requires 2 strings as parameters. Call it like this;

al("password", "name");

And it will work.

commented: easy peasy :) +1

This is the method definition. private void al(String password, string name) How many parameters (arguments) does it take?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.