Mike Askew 131 Veteran Poster Featured Poster

Can we have some example values for v, n and d?

Mike Askew 131 Veteran Poster Featured Poster

Problem averted then :)

Mike Askew 131 Veteran Poster Featured Poster

In reply to the partitioning question, there is always the risk of something going wrong, I did mine with a fresh install of OSX (at the time) just to clear the hdd of any rubbish so I didn't really need to back anything up.

I suppose its more for peace of mind as to whether or not you take the risk.

Mike Askew 131 Veteran Poster Featured Poster

To avoid the risk of losing data there are devices such as external harddrives which will allow you to backup files.

The process of partitioning is pretty easy using macs own built in tools, I just did mine by booting from the OS disc and partitioning using the HDD management tools on it (bootcamp)

Mike Askew 131 Veteran Poster Featured Poster

There is a relatively limited range on Mac, I found all the IDE's definately lack the additional extras VS provides such as intellisense. Personally I would go for the boot partition and VS.

MonoDevelop is the only one I've heard of and I dont remember liking it when I used it, all preference though.

Mike Askew 131 Veteran Poster Featured Poster

I'm pretty sure it's in my Daniweb contract somewhere that I have to crush dreams on a regular basis.

But but but... the Unicorn/MyLittlePony fills me with hope of happiness!

<M/> commented: haha +0
Mike Askew 131 Veteran Poster Featured Poster

Im pretty sure it is the top kudos member for the page your looking at. Hovering over the image lists kudos amount and they are in descending order, left to right.

Does leave me with a sense of pride that the only member that has kudos in XML, XSLT and XPATH :)

Mike Askew 131 Veteran Poster Featured Poster

@Ralph1992, When you joined DaniWeb you accepted the Terms of Service in which it states:

Posting Posts contributed to the community immediately become the property of DaniWeb upon submission. Members may edit their posts for a limited time period immediately after, for the purpose of correcting spelling and grammar mistakes and accidental ommissions. After this initial period expires, posts may only be edited or deleted by DaniWeb team members, and only in cases where they do not comply with our forum rules for the purpose of making said content comply with all rules. As a discussion community, posts contributed by many members work together to form coherent discussions. Altering or deleting individual posts may have consequences that unfairly extend to other members of the community. All members are held responsible for their actions. As always, think before you permanently post something on the public Internet.

Therefore the action you request is very unlikely as it breaks up the entire thread, most code help forums operate in a similar fashion. For example when I was help with code I generally modify it to remove sensitive sections of the code and information it reveals.

Mike Askew 131 Veteran Poster Featured Poster

@Dani: I'm wondering whether you should change "Endorse" into "Yes". My english is pretty decent, but I had to think twice what you meant. Am sure it's a lot harder for many others. Am quite positive it would increase usage.

Agree with you here, a lot simpler to understand.

I've clicked on my profile about 10 times in last minute now to see names, only problem being most are asking about the vb.net forum and I've not been active in there in over two years :)

Mike Askew 131 Veteran Poster Featured Poster

Ah that seems fair enough

Mike Askew 131 Veteran Poster Featured Poster

Lucky I dislike Twitter then isn't it :) I will have to find stuff on my own / rely on threads like this!

Mike Askew 131 Veteran Poster Featured Poster

I agree it is a nice addition to the site. A changelog as to what is done, like notably for users would also be interesting to follow and read from time to time :)

Mike Askew 131 Veteran Poster Featured Poster

See here for a start.

Mike Askew 131 Veteran Poster Featured Poster

It isn't particularly hard to make contributions to nearly every running thread in the community centre. I could do this to boost my post count also, but that doesn't affect me either. ;)

Mike Askew 131 Veteran Poster Featured Poster

I would say its quality over quantity where posts are concerned to be honest. Anyone can write responses to lots of threads across the forum. Not everyone can give a useful contribution consistently.

Mike Askew 131 Veteran Poster Featured Poster

Wow I have to be honest and say I've never scrolled down that page to find such stats :o Always presumed it just listed like the top 100 people for rep etc and that was it!

Mike Askew 131 Veteran Poster Featured Poster

There's such a list?

Mike Askew 131 Veteran Poster Featured Poster

a good candidate is an expert in their field

Oops, there goes my chances ;)

Mike Askew 131 Veteran Poster Featured Poster

@Ange1 and there was me thinking hello world was first :(

with regards to tutorials, I have a sticky post at the top of this forum which you have failed to read stating exactly what your after.

Mike Askew 131 Veteran Poster Featured Poster

Radio buttons only allow one to be selected, they are designed for this purpose.

Mike Askew 131 Veteran Poster Featured Poster

Good to hear, mark as solved if nothing further is required.

Mike Askew 131 Veteran Poster Featured Poster
            List<string> Names = new List<string>();
            List<string> SortedRefinedNames = new List<string>();
            StreamReader sr = new StreamReader(@"C:\Users\maskew\Desktop\Names.txt");
            string NameEntry;
            while ((NameEntry = sr.ReadLine()) != null)
            {
                Names.Add(NameEntry);
            }
            sr.Close();

            Console.Write("First letter of name to search: ");
            string Letter = Console.ReadLine();

            foreach (string Name in Names)
            {
                if (Name.Substring(0, 1).ToUpper() == Letter.ToUpper())
                    SortedRefinedNames.Add(Name);

            }

            SortedRefinedNames.Sort();

            foreach (string Name in SortedRefinedNames)
            {
                Console.WriteLine(Name);
            }

            Console.ReadLine();
Mike Askew 131 Veteran Poster Featured Poster

So say I had this as my list

Steve A
Steve B
John C
Scott A
Dani T

and wanted the letter S, your output should be:

Scott A
Steve A
Steve B

Correct?

Mike Askew 131 Veteran Poster Featured Poster

I don't find what your trying to do clear. Nor is the example data any good. Do Bla Bla count as an individual? or information relating to Someone else? Please consider re-doing the explanation with clarified requirements.

Mike Askew 131 Veteran Poster Featured Poster

This will be of help with clearing a WebBrowser's cache.

Mike Askew 131 Veteran Poster Featured Poster

I believe @Pritaeas means the following:

public class PersonDetailsComparer : IComparer<PersonDetails>
    {
        public int Compare(PersonDetails x, PersonDetails y)
        {
            if (x.FirstName == "Lever")
                return 1;
            if (y.FirstName == "Lever")
                return -1;

            int returnValue = 0;
            if (x != null && y != null && x. FirstName != null && y. FirstName != null)
            {
                    return x.FirstName.CompareTo(y.FirstName );
            }
            return returnValue;
        }
    }
Mike Askew 131 Veteran Poster Featured Poster

Cheers for the advice Dan

Mike Askew 131 Veteran Poster Featured Poster

Method example:

public int MyMethod(int NumberToAddTo, out bool Success)
{
    NumberToAddTo++;
    Success = true;
    return NumberToAddTo;
}

Call Example:

public void FormMethod()
{
    bool MethodSuccessful;
    int Number = 10;

    Number = MyMethod(Number, out MethodSuccessful);
}
Mike Askew 131 Veteran Poster Featured Poster

Im amazed nobody has suggested using an out parameter here.

public string[] LandsKodComboBox(string[] dendei1, string[] dendei2, out string[] returnDendei)
        {
            string[] dendei1 = new string[5];
            string[] dendei2 = new string[7];
            //assign the array
            dendei1[2]="hello";
            //etc etc....
            returnDendei = dendei2;
            return dendei1;
        }
Mike Askew 131 Veteran Poster Featured Poster

Because the XML is loaded on the main form we will need to do the refreshing there. You will need to refresh and then reload all the data into the right places however as just reloading the file wont do that.

If it isnt working ensure youve set the dialog result values of the apply changes button to OK if using my code.

sundog1 commented: great help! +2
Mike Askew 131 Veteran Poster Featured Poster

I dont believe so because the XML is being handles on the main form?

Mike Askew 131 Veteran Poster Featured Poster

No worries, gimme a shout if you get stuck

Mike Askew 131 Veteran Poster Featured Poster

Use .ShowDialog() instead of .Show(). This will make the form behave similar to a messagebox in terms of nothing else apart from the form can be clicked until the form is closed.

.ShowDialog() also allows you to assign dialog responses to buttons on your form and then do logic based off your form response (used when making custom message boxes etc).

To reload the XML data you will need to rerun the entire of the method that loads the XML I think unless you literally just want to reload the XML file into memory. Which would be for example:

private void label5_Click(object sender, EventArgs e)
        {
            About LF = new About();
            LF.ShowDialog();

            //Written in the browser it may be slightly off
            if (LD.DialogResult == DialogResult.OK)
            {
                smtpDetails = new XmlDocument();
                smtpDetails.Load(PATH);
            }
        }

When running modal forms however you will need to assign the button return for the dialog, this is done using the property DialogResult of the button. The example code is based off of the confirmation button being set to a result of "Ok".

Mike Askew 131 Veteran Poster Featured Poster

Ok.

Firstly, your admin form does not run modally (ie. the main form is still accessible while the admin form is open), is this the intention? Obviously not sure how the form works/is used for.

Secondly, irritatingly running the form non-modally means my idea for refreshing the XML wont work due to the continued execution of the thread, which is paused with a modal form.

Mike Askew 131 Veteran Poster Featured Poster

Wheres the code block on the main form calling the admin one? (assuming there is one)

Mike Askew 131 Veteran Poster Featured Poster

Form1.Refresh() Just redraws the form and its associated objects on screen.

You will need to rerun smtpDetails.Load(PATH); to reload the XML document.

This will be done in the code block that makes the admin form (dont have that in my inbox either so cant comment on the exact layout, it would go after the .Show() call or .ShowDialog()

Mike Askew 131 Veteran Poster Featured Poster

Hahah, Sorry Mikey/Dave/Fred.. :)

xD

Mike Askew 131 Veteran Poster Featured Poster

Hi Dave,

Im now multiple people muahahaha!

Hmm thats an odd issue. Especially when its working for me.

Might be worth debugging the method and seeing what the XmlNodeList contains at execution time. Should say count = 1 as one of its properties as it does when I run the program.

Mike Askew 131 Veteran Poster Featured Poster

Umm I don't see why it wouldnt work :/

What does the variable PATH contain i.e. the actual value? As that could be the only reason it isnt working.

Mike Askew 131 Veteran Poster Featured Poster

In that case you should be able to adapt the above code I gave into your program.

Try:

private void Send_Click(object sender, EventArgs e)
        {
            if (File.Exists(@"C:\Timewade\Quickticket\Person.xml"))
            {
                smtpDetails = new XmlDocument();
                smtpDetails.Load(PATH);

                XmlNodeList results = smtpDetails.GetElementsByTagName("Company_Name");
                compName.Text = results[0].InnerText;

Explanation:

The XmlNodeList will contain all nodes returned from the .GetElementsByTagName() call and from there, as we know there is only one element, we can reference the position 0 in the XmlNodeList and then find its .InnerText which contains what is inside the element in the XML.

Mike Askew 131 Veteran Poster Featured Poster
        static void Main(string[] args)
        {
            string XMLFilePath = @"C:\Users\maskew\Documents\DaniWeb\TestXML.xml";

            XmlDocument XmlFile = new XmlDocument();
            XmlFile.Load(XMLFilePath);

            XmlNodeList Results = XmlFile.GetElementsByTagName("Company_Name");
            Console.WriteLine(Results[0].InnerText);
            Console.ReadLine();
        }

Little console app I ran and retrieved the value, console displayed: "TEST COMPANY". This method assumes that there is only one entry of the <Company_Name></Company_Name> per XML file.

Is that the case?

Mike Askew 131 Veteran Poster Featured Poster

Cheers, its worth noting standalone="" expects a yes or no as its value.

Can you also disclose the variable type of root as it cannot be determined from code.

Mike Askew 131 Veteran Poster Featured Poster

Hi Mark,

Any chance of getting this XML sheet? Or a stripped down version of it showing the part causing the issue?

Edit: could you also disclose the variable type of root as it cannot be determined from code.

Mike Askew 131 Veteran Poster Featured Poster

Yeap I've seen that link also, it is pretty complex. Hence why I didnt look that much into it :)

Mike Askew 131 Veteran Poster Featured Poster

Ummm.. It would look odd yes.

I dont know of a way to specifically add a header entry.

Mike Askew 131 Veteran Poster Featured Poster

Yeap can do it exactly that way. Adaption to my code above would appear as the following:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace DaniWebWinForm
{
    public partial class Form1 : Form
    {
        DataSet DS = new DataSet();
        bool FormLoading = false;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            FormLoading = true;
            DS.Tables.Add("NameTable"); //Setup table holding names

            DS.Tables["NameTable"].Columns.Add("NameID"); // Primary key
            DS.Tables["NameTable"].Columns.Add("Name");
            DS.Tables["NameTable"].Columns.Add("Age");

            DS.Tables["NameTable"].Rows.Add(1, "Mike Jobs", "23");
            DS.Tables["NameTable"].Rows.Add(2, "Jack Starling", "24");
            DS.Tables["NameTable"].Rows.Add(3, "Sam Eker", "16");
            DS.Tables["NameTable"].Rows.Add(4, "Dani West", "20");
            DS.Tables["NameTable"].Rows.Add(5, "Steve Marvin", "31");

            // Adding the new column and programatically assigning the value
            DS.Tables["NameTable"].Columns.Add("ConCatInfo", typeof(string), "Name + ' | ' + Age");

            comboBox1.DataSource = DS.Tables["NameTable"];
            comboBox1.DisplayMember = "ConCatInfo";
            comboBox1.ValueMember = "NameID";
            FormLoading = false;
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!FormLoading)
                MessageBox.Show(comboBox1.SelectedValue.ToString());
        }


    }
}

With regards to displaying the column headers above, you can just use a label and space out the entries :)

Mike Askew 131 Veteran Poster Featured Poster

Hmm it all depends on whether or not your able to edit the DataTables as to how you approach this.

Its either add a new column to the datatable which contains a concatenation of the data you wish to display or write a custom class that overrides the combobox. Which I know there is code for on google because I've just looked at it :)

Mike Askew 131 Veteran Poster Featured Poster

Yeap I've tried that too! :p

Mike Askew 131 Veteran Poster Featured Poster

Nope the combo box was set to display the name only using the line: comboBox1.DisplayMember = "Name";, I added the Age field simply so I didnt just make two columns and assign each to a property.

Give me a couple of mins to have a play and I'll see :)

Mike Askew 131 Veteran Poster Featured Poster
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace DaniWebWinForm
{
    public partial class Form1 : Form
    {
        DataSet DS = new DataSet();
        bool FormLoading = false;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            FormLoading = true;
            DS.Tables.Add("NameTable"); //Setup table holding names

            DS.Tables["NameTable"].Columns.Add("NameID"); // Primary key
            DS.Tables["NameTable"].Columns.Add("Name");
            DS.Tables["NameTable"].Columns.Add("Age");

            DS.Tables["NameTable"].Rows.Add(1, "Mike Jobs", "23");
            DS.Tables["NameTable"].Rows.Add(2, "Jack Starling", "24");
            DS.Tables["NameTable"].Rows.Add(3, "Sam Eker", "16");
            DS.Tables["NameTable"].Rows.Add(4, "Dani West", "20");
            DS.Tables["NameTable"].Rows.Add(5, "Steve Marvin", "31");

            comboBox1.DataSource = DS.Tables["NameTable"];
            comboBox1.DisplayMember = "Name";
            comboBox1.ValueMember = "NameID";
            FormLoading = false;
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!FormLoading)
                MessageBox.Show(comboBox1.SelectedValue.ToString());
        }


    }
}

Simple WinForms App using one combo box.

Everytime you select a name from the combo box it will display the NameID field value related to that name. Hope that helps you understand :)