?
Solved

Required Files

Posted on 2005-05-05
6
Medium Priority
?
172 Views
Last Modified: 2010-04-16
I have a control that I have created.  What I am trying to figure out now is that I have a folder with a couple of files(text files) that are required for the control to work.  How can I make it so that any time the control is used, the folder with the files will be loaded with the control?????

Thanks,
Kendal
0
Comment
Question by:gvector1
  • 2
  • 2
  • 2
6 Comments
 
LVL 21

Expert Comment

by:Yurich
ID: 13940538
what do you mean by "the folder with the files will be loaded with the control??"??

what do you mean by "loading a folder"? do you mean opening and accessing txt files before your control is created/addressed?

do you want ot "load" your stuff when your control is used (at the same time it clicked, pressed, etc) or before your control is used (i.e. when it's created)

regards,
mik

0
 

Author Comment

by:gvector1
ID: 13940574
It is a folder of files that will need to be accessed as a function of the control is used.  The control will be a richtextbox with spellcheck capabilities.  The folder I am needing is a folder containing the default dictionaries that will be used.  Therefore I will need those wherever I use the control.  Any suggestions.

Thanks,
Kendal
0
 
LVL 14

Expert Comment

by:existenz2
ID: 13940749
The following sample will check when the form is loaded if the dictionary files are available in "{installation path}\dict\". If it doesn't exists it raises an error.

using System;
using System.Windows.Forms;

namespace Test
{
      public class MainForm : System.Windows.Forms.Form
      {
            private System.ComponentModel.IContainer components;

            public Form1()
            {
                  InitializeComponent();
            }
         
            [STAThread]
            public static void Main(string[] args)
            {
                  Application.Run(new Form1());
            }
         
            private void InitializeComponent()
            {
                  this.components = new System.ComponentModel.Container();
                  //
                  // MainForm
                  //
                  this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
                  this.ClientSize = new System.Drawing.Size(432, 341);
                  this.Name = "MainForm";
                  this.Text = "MainForm";
                  this.Load += new System.EventHandler(this.Form1_Load);

            }

            private void Form1_Load(object sender, System.EventArgs e)
            {
                  if(!System.IO.File.Exists(Environment.CurrentDirectory+"\\dict\\dutch.dict"))
                        throw new Exception("Required dictionary not found!");
            }



      }
}
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 21

Expert Comment

by:Yurich
ID: 13940977
that's right, you can do it either in the constructor or fom_load...
0
 

Author Comment

by:gvector1
ID: 13960209
That will check to see if it exists, but I would like to know if there is a way that the folder containing the dictionaries could be added along with the control so that it will be contained locally to the executable.
0
 
LVL 14

Accepted Solution

by:
existenz2 earned 2000 total points
ID: 13960518
You can do that by making an installer with the "Setup and Deployment" tools which are included in VS.NET. File -> Add Project -> New Project -> Setup and Deployment Project -> Setup Project / Setup Wizard.

Some info about it:
http://www.15seconds.com/issue/040323.htm
http://www.15seconds.com/issue/040324.htm
http://www.c-sharpcorner.com/deployment/deployment_1.asp
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Loops Section Overview
Suggested Courses
Course of the Month15 days, 12 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question