folder in the project

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ventsislav
    New Member
    • Mar 2009
    • 16

    folder in the project

    How can I save file in the dir "Data", which I add to the project earlier. My project' s called Sol1, so here' s the code I' m using:

    Code:
    private void OK_Click(object sender, EventArgs e)
        {
            RegFile = new FileInfo("Sol1.Data." + MyCombo.SelectedItem.ToString() + ".mdb");
    
            for (int i = 0; i < 23; i++)
            {
                if (RegFile.Exists == true)
                {
                    MessageBox.Show("Exists!", "Sol1");
                    
                    return;
                }
                else if (i == MyCombo.SelectedIndex)
                {
                    RegFile.Create();
                }
            }
        }
    Why it doesn' t create a file in "Data"?
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Because directories don't use a period as their seperator.

    "Sol1.Data. " is not a valid path

    Comment

    Working...