Adding new project in current project?

How do i add new c# project file to a current project so that when i click a button on the current project it will invoke the project added...

can also anyone provide me with c# code on "BROWSE" .. so that i can choose directory on where i want to save my file...

thanks



Answer this question

Adding new project in current project?

  • eTape

    ahmedilyas wrote:

    I dont see why placing theFolderBrowserDialog command in brackets works....its a string type thats being returned in the SelectedPath property so it should work...

    well the folder browser dialog only browses to the folder, you can use a SaveFileDialog, pretty much in the same way, if you want to save a file for example except you have to write the code for saving the file.

    however if you still want to go this way then its usually:

    theFolderBrowserDialog.SelectedPath + "\\" + fileNameChosen;

    which will show you the folder you selected and the file name chosen concatinated together for you to display

    does this work is this what you are after

    if you want to use the SaveFileDialog then you do this:

    SaveFileDialog theSFD = new SaveFileDialog();

    theSFD.Filters = "yourFiltersHere";

    if (theSFD.ShowDialog() == DialogResult.OK)

    {

    this.txtFileName.Text = theSFD.FileName;

    }

    more about the SFD:

    http://msdn2.microsoft.com/en-us/library/system.windows.forms.savefiledialog.aspx



    hi thanks, it does work now. thanks alot! :)
    assalamualaikum


  • ink innovations

    Thanks alot for the answer. But i have a problem now.

    Instead of MessageBox.Show(theFolderBrowserDialog.SelectedPath);

    I want my SelectedPath to appear in this:


    this.txtFilename.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    this.txtFilename.Location = new System.Drawing.Point(63, 342);
    this.txtFilename.Name = "txtFilename";
    this.txtFilename.Size = new System.Drawing.Size(265, 20);
    this.txtFilename.Text = "Browse And Select Where you want to save your captured video";
    this.txtFilename.TextChanged += new System.EventHandler(this.txtFilename_TextChanged);


    Noted that, when i run the rpoject the txtFilename is already has the "Browse And Select Where you want to save your captured video" displayed in its box/textfield

    I tried the:

    txtFilename.Text(theFolderBrowserDialog.SelectedPath);
    this.txtFilename.Text(theFolderBrowserDialog.SelectedPath);

    but it prompt an error saying:

    "System.Windows.Forms.Control.Text' is a 'property' but is used like a 'method'"


    So how do i do that






  • R.Tutus

    ahmedilyas

    thanks alot, i really appreciate it, but the code above doesnt work instead i use this:

    this.txtFilename.Text = (theFolderBrowserDialog.SelectedPath);

    it does work, but i have this problem, how do i give a filename to it

    instead of SelectedPath alone, i want it to be like SelectedPath\filenamegiven , can i like after pressing OK , it popup a windows asking me to enter a fileName and then it will appears in the txtFilename as:

    SelectedPath\Filename_Given

    is that possible

    i have msn - movexz@hotmail.com


  • georgeob

    If I understand correctly you wish to show the path the user selected in the txtFileName if so, try this:

    this.txtFileName.Text = theFolderBrowserDialog.SelectedPath;

     

    does this help is this what you are after



  • U.Seung

    I dont see why placing theFolderBrowserDialog command in brackets works....its a string type thats being returned in the SelectedPath property so it should work...

    well the folder browser dialog only browses to the folder, you can use a SaveFileDialog, pretty much in the same way, if you want to save a file for example except you have to write the code for saving the file.

    however if you still want to go this way then its usually:

    theFolderBrowserDialog.SelectedPath + "\\" + fileNameChosen;

    which will show you the folder you selected and the file name chosen concatinated together for you to display

    does this work is this what you are after

     

    if you want to use the SaveFileDialog then you do this:

    SaveFileDialog theSFD = new SaveFileDialog();

    theSFD.Filters = "yourFiltersHere";

    if (theSFD.ShowDialog() == DialogResult.OK)

    {

       this.txtFileName.Text = theSFD.FileName;

    }

     

    more about the SFD:

    http://msdn2.microsoft.com/en-us/library/system.windows.forms.savefiledialog.aspx



  • Java Q

    Hi,
    You can't add a new project to an existing project. Rather you can add to a solution. For this, you must right click on the solution>Add>Add new project. In this way, you can add a new project.
    To get the funtionality of the BROWSE,
    private OnBrowse(.....)|
    {
    SaveFileDialog svDialog=new SaveFileDialog();
    svDialog.ShowDialog();
    ........
    ........
    ........

    }

    Regards,
    Wasif Ehsan.


  • my_display_name

    Sure.

    To add a project in your current solution, just right click the solution in the solution explorer, go to add > new project and select the project you wish to add, this will add the project to the solution of yours :-)

    Now as for the directory, take a look at the FolderBrowse dialog. This allows you to browse to a folder, so you can get the value from this set by the user from the chosen directory and use it the way you like. Example:

    FolderBrowserDialog theFolderBrowserDialog = new FolderBrowserDialog();

    theFolderBrowserDialog.ShowDialog();

    you then get the value the user chose from the SelectedPath property. So here is an example:

    FolderBrowserDialog theFolderBrowserDialog = new FolderBrowserDialog();

    if (theFolderBrowserDialog.ShowDialog() == DialogResult.OK)

    {

    MessageBox.Show(theFolderBrowserDialog.SelectedPath);

    }

    does this help



  • Adding new project in current project?