DdoubleD 315 Posting Shark

Furthermore, getting past date checks used by a setup are easily gotten around by temporarily changing the system date, but you could also depend on checking the last modification date of a system file....

DdoubleD 315 Posting Shark

Actually, in my application there is no trial period.I just want to make my application valid for a period of 1 year after it is installed on target computer.And once installed then it should not be copied on any other computer.My application has no trial period,just want to make it accessible for 1 year.After 1 year ,it should automatically blocks.l
So can you help me regarding this............!!

I may not have the answer for you, but more information is needed. Is this a client/server application? If not, how would you expect to invalidate the license if they installed on another machine. Or, have you considered registration via internet and requiring a periodic license validation check using that same strategy?

EDIT: If you want to ship each installation with a built in appx expiration that the setup itself would adhere to and prevent user from completing an installation past that period, you could build this into the setup with custom action. However, this still doesn't "block" your already installed application from continuing to execute/startup past this period.

DdoubleD 315 Posting Shark

Is there any way to declare a single variable which can change its type depending upon the type of post? It should also be accessible so as to be added to a list.

A reference of type object can be set to any type. Then, you can determine type with typeof(string) or typeof(int) or typeof(Post) etc. .

DdoubleD 315 Posting Shark

I want to ask one thing .......
that i want to set a feature in my application such that after a particular period of time my application should automatically block.....And my application once installed, than should not be installed on other computer........?
Just tell me how to do this? Do i have to use registry concept or there is any other method for this......?
If there is any other concept for this, so kindly tell me which concept i should use.........? :pretty:

I doubt any developer wants to post an example of how they have encoded a trial evaluation scheme into their application for obvious reasons. Take a look at these search results: Application Trial Expiration C#

DdoubleD 315 Posting Shark

Alba, I don't really know this game, but I did spot a couple of things I thought worth mentioning. Have you stepped through each line of this code to see if what is happening?

I noticed you are incrementing GlobalVariables.countresultslots at the beginning of each loop, and then referencing an element of ResultForm.SlotField[GlobalVariables.countresultslots] from that location. On the surface, this looks very suspicious because usually array/list elements are not referenced higher than Count - 1 .

You also calculate an indexer several times for the same purpose of referencing an element: [(GlobalVariables.countresultslots / (GlobalVariables.configsetup[0] + 2)) + i] . Not only is this redundant and a waste of processing time, but it makes it more difficult to watch what is happening. I suggest breaking the calculation out, for example:

// change
ResultForm.ResultLabel[(GlobalVariables.countresultslots / (GlobalVariables.configsetup[0] + 2)) + i].AutoSize = true;
    ResultForm.ResultLabel[(GlobalVariables.countresultslots / (GlobalVariables.configsetup[0] + 2)) + i].Location = new Point((GlobalVariables.configsetup[0] + i)* 60, (GlobalVariables.guesscounter - 1) * 60);
    ResultForm.ResultLabel[(GlobalVariables.countresultslots / (GlobalVariables.configsetup[0] + 2)) + i].Size = new System.Drawing.Size(42, 20);
    ResultForm.ResultLabel[(GlobalVariables.countresultslots / (GlobalVariables.configsetup[0] + 2)) + i].TabIndex = 0;
    ResultForm.ResultLabel[(GlobalVariables.countresultslots / (GlobalVariables.configsetup[0] + 2)) + i].Enabled = false;

// to something like:
            int index = (GlobalVariables.countresultslots / (GlobalVariables.configsetup[0] + 2)) + i;
            ResultForm.ResultLabel[index].AutoSize = true;
            ResultForm.ResultLabel[index].Location = new Point((GlobalVariables.configsetup[0] + i) * 60, (GlobalVariables.guesscounter - 1) * 60);
            ResultForm.ResultLabel[index].Size = new System.Drawing.Size(42, 20);
            ResultForm.ResultLabel[index].TabIndex = 0;
            ResultForm.ResultLabel[index].Enabled = false;

That also makes it easier to read and there won't be a need to create a temporary storage to …

DdoubleD 315 Posting Shark

Anteka, very good reply! I had to look up the SOS (Spiritually Optimized System) acronym though--LOL.

DdoubleD 315 Posting Shark

Is the data structure static in that it will always be in the format exampled?

DdoubleD 315 Posting Shark

LabelPanel huh...very interesting!:P

DdoubleD 315 Posting Shark

LOL - My sympathies too. I didn't have any trouble except for what I initially reported, but I only ran the code once that I submitted and none of the proposed changes. Several hours later I simply shutdown all my apps, deleted the new user, rebooted, then deleted the document folder.

:D ...still laughing...

I would like to suggest keeping this thread alive until all of the "minor" issues, :D, have been resolved, then posting a final solution so others can benefit.;)

DdoubleD 315 Posting Shark

Did you get it working?

I have a hunch that there is a problem with that. After I ran that code I started noticing odd behavior on my machine. I closed winamp and when I re-opened it all of a sudden my playlist was different.

Then I started noticing websites where I have my password stored, like daniweb, required me to log in again. I was thinking 'wtf'

Then I tried to reboot my machine:

The attempt to rebootSCOTTIE failed

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
The attempt to power off SCOTTIE failed

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

That being said it I think that code screws up who windows think the logged on user is. The *only* thing that worked was logging off which then finally allowed me to reboot and since then everything has seemed ok. Review the code for something changing the active user. If you can't find anything then let me know and I will take a look at it.

Its a very long piece of code and i'm in the middle of a project right now :(

[edit]
The NETWORK vs. INTERACTIVE might have been the issue. It might have switched the INTERACTIVE logged on profile (me) to that user profile that I created. I deleted the profile directory in C:\Document and Settings\ right after I created it, which may be why the browser cookies etc couldn't save.
[/edit]

LOL - …

DdoubleD 315 Posting Shark

Just an FYI and you still need to mark this question as SOLVED.

FYI: Not sure why a text editor application would launch a new instance of itself. Have you considered using an MDI Form?

DdoubleD 315 Posting Shark

Not sure why that is a problem. Don't know much about your app and you included no code having trouble, so is a design issue?

DdoubleD 315 Posting Shark

Well - wasn't able to figure out why but there is a difference between NETWORK and INTERACTIVE logon type, if you use INTERACTIVE and do not include any of the marshaling then everything works perfectly fine - and that is what I needed ...

You have both provided me with a LOT of help - thank you very much ... Let me know if you figure out why it is different when using the NETWORK login type.

Not sure why it is different, but I can tell you why I used NETWORK. The MS link indicated it was best:

// Do a network logon because most systems do not grant new users
      // the right to logon interactively (SE_INTERACTIVE_LOGON_NAME)
      // but they do grant the right to do a network logon
      // (SE_NETWORK_LOGON_NAME). A network logon has the added advantage
      // of being quicker.
DdoubleD 315 Posting Shark

Set as last statement in your Main method something like Console.ReadKey(); otherwise your Console window will vanish into oblivion...
Might be a typo but in Main you are calling SetUpTheArrays in your class this method is defined as SetUptheArrays.
Find your coding style a bit weird, but fine with me we are luckily still rocking I a free world;)

Man, I was hit-n-miss all over this one. Glad you spotted that ddanbe. ;)

DdoubleD 315 Posting Shark

free world?

LOL

You also need to probably use your floatCounter as your index. Then, you can probably disregard intializing as I suggested earlier ;):

floatArray[floatCounter] = Convert.ToSingle(Console.ReadLine());

Also, you copy the floatArray, but I don't see that you use it... EDIT: Nevermind this statement

DdoubleD 315 Posting Shark

Calling CloseMainWindow will essentially send a Close request message to the running application, whereby it is up to that application to handle the event--This is the most graceful approach because it allows the application to perform it's normal process termination. It should be followed by a call to Close to perform resource cleanup.

// Close process by sending a close message to its main window.
            myProcess.CloseMainWindow();
            // Free resources associated with process.
            myProcess.Close();

Calling Kill will terminate the process, but at the risk of losing any unsaved data or even corrupting data if in progress of writing. I believe that allocated resources my also not be freed. You can call Kill if the above recommended close fails.

As far as the MainWindowHandle, I'm not sure why are you are doing that.

Also, take a look at this article: Make Your Application Shutdown Aware. If you implement graceful handling of a close request in your process, you should have not problems when you want to shut it down from your service.

Cheers!

Here is a suggestion based on my understanding:

Process[] myProcesses;
            myProcesses = Process.GetProcessesByName("Display");
            foreach (Process myProcess in myProcesses)
            {
                // gracefully request close of main window
                if (myProcess.CloseMainWindow()) // NOTE: can only use Kill for Console app
                    myProcess.Close();

                // then if it did not and you still want to force it...
                if (!myProcess.HasExited)
                    myProcess.Kill();
            }
DdoubleD 315 Posting Shark

zip up the project and attach. If using a small access table for the report, include that too.

DdoubleD 315 Posting Shark

You did not initialize your array:

public void SetUptheArrays()
        {
            //declare arrays 
            int[] integerArray = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            float[] floatArray = new float[5];

// initialize
floatArray[0] = 100.99;
floatArray[1] = 324.333354;
//...            
floatArray[4] = 0932409.3; // last element of this array
 
            DisplayOddNumbers(integerArray);
            DisplayNegativeNumbers(floatArray);
        }
DdoubleD 315 Posting Shark

Calling CloseMainWindow will essentially send a Close request message to the running application, whereby it is up to that application to handle the event--This is the most graceful approach because it allows the application to perform it's normal process termination. It should be followed by a call to Close to perform resource cleanup.

// Close process by sending a close message to its main window.
            myProcess.CloseMainWindow();
            // Free resources associated with process.
            myProcess.Close();

Calling Kill will terminate the process, but at the risk of losing any unsaved data or even corrupting data if in progress of writing. I believe that allocated resources my also not be freed. You can call Kill if the above recommended close fails.

As far as the MainWindowHandle, I'm not sure why are you are doing that.

Also, take a look at this article: Make Your Application Shutdown Aware. If you implement graceful handling of a close request in your process, you should have not problems when you want to shut it down from your service.

Cheers!

DdoubleD 315 Posting Shark

Ooooooh Scott, come on man, I know you know the answer... ;) Help us out please?

DdoubleD 315 Posting Shark

DdoubleD: why do you only set the Password to IntPtr and do the Marshling? Why not username and domain also?

Because of this prototype declaration I found (see below). It's possible that it is incorrect because I just pulled it off the web and not from MSDN, which we know is always correct too--LOL.

Anyway, after really thinking about it, I doubt seriously that prototype is correct using "String" in a Win32 API call. Also, look at the variable naming convention: lpsz, or long pointer to null-terminated string (long pointer to null terminated char array in C/CPP; aka char*).

The answer is near though...

/// 
        /// The LogonUser function attempts to log a user on to the local computer.
        /// 
        [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern bool LogonUser(String lpszUsername, String lpszDomain, IntPtr lpszPassword, int dwLogonType, int dwLogonProvider, out IntPtr hToken);
DdoubleD 315 Posting Shark

Remember you, remember me,
And if at all, we should disagree,
To help with you, remember me.

You didn't invite me to the goodbye party, so I thought I would make an entrance... Best wishes Serkan.

DdoubleD 315 Posting Shark

I think you will find this link resourceful: PC Parallel Port Interfacing

DdoubleD 315 Posting Shark

Check out this thread:
http://www.daniweb.com/forums/thread209516.html

I believe there is some confusion in the beginning of the thread concerning what right-to-left means, but go down toward the bottom and also sknake attached a project that demonstrates the label expansion.

DdoubleD 315 Posting Shark

OK, I ran this code on my XP laptop and it did create the profile. However, when I went to look under documents and settings, the username I expected to see was cryptic looking (3 vertical rect chars?)--I don't know what you call those chars but you see them all the time if you open a binary file in notepad.

Anyway, take a look at it and let me know also if it worked and what's up with how it created my user's folder name as mentioned above. It is initiated by calling static method: WindowsLoadUserProfile.Test()

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Principal;

namespace ForumSolutions
{

    public class WindowsLoadUserProfile
    {
        /// 
        /// The LogonUser function attempts to log a user on to the local computer.
        /// 
        [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern bool LogonUser(String lpszUsername, String lpszDomain, IntPtr lpszPassword, int dwLogonType, int dwLogonProvider, out IntPtr hToken);

        /// 
        /// The DuplicateTokenEx function creates a new access token that duplicates an existing token. This function can create either a primary token or an impersonation token.
        /// 
        [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern bool DuplicateTokenEx(IntPtr hExistingToken, int dwDesiredAccess, ref SecurityAttributes lpTokenAttributes,
        int impersonationLevel, int tokenType, out IntPtr phNewToken);

        /// 
        /// The LoadUserProfile function loads the specified user's profile
        /// 
        [DllImport("userenv.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern bool LoadUserProfile(IntPtr hToken, ref ProfileInfo lpProfileInfo);

        /// 
        /// The UnloadUserProfile function unloads a user's profile that …
DdoubleD 315 Posting Shark

What OS are you testing that LoadUserProfile call on?

DdoubleD 315 Posting Shark

I'm not sure you can invoke the creation of the new user's profile without logging the user onto the system, which is when a new user's profile gets created (logging in for the first time).

Have you tried LogonUser (advapi32.dll) and Impersonation? See: Windows Impersonation. I have my doubts, but if you have not tried it yet you might give it shot.

DdoubleD 315 Posting Shark

Not sure why your datagridview doesn't always have an unpopulated record shown. Check this code. As soon as you type anything in a cell, it will append a new unpopulated record/row to the end of the grid, which will again repeat as soon as you type anything in the new row...

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;

namespace ForumSolutions
{
    public class Form_DataGridView_AddRow : Form
    {
        public Form_DataGridView_AddRow()
        {
            InitializeComponent();
        }

        private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e)
        {

        }

        #region Designer generated code

        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.dataGridView1 = new System.Windows.Forms.DataGridView();
            this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
            this.SuspendLayout();
            // 
            // dataGridView1
            // 
            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Column1,
            this.Column2,
            this.Column3});
            this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.dataGridView1.Location = new System.Drawing.Point(0, 0);
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.Size = new System.Drawing.Size(489, 278);
            this.dataGridView1.TabIndex = 0;
            this.dataGridView1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.dataGridView1_KeyPress);
            // 
            // Column1
            // 
            this.Column1.HeaderText = "Column1";
            this.Column1.Name = "Column1";
            // 
            // Column2
            // 
            this.Column2.HeaderText = …
DdoubleD 315 Posting Shark

Maybe something useful in this information: System.DirectoryServices Using Guide

DdoubleD 315 Posting Shark

I took the time to wrap up this exercise. The setup can now:

User Interface View - Look at the properties for TextBoxes (A) under Start category to see how:
1) 2nd dialog (from predefined template) prompts for a message and will store the result in a property called [MESSAGE].

Custom Actions View - look at order in interface and properties of each to see how:
1) calls a custom action, which will display parameter [MESSAGE]
2) calls a custom action override for Install and Uninstall methods; Install method will display all session parameters available when called.
3) calls another custom action that does nothing except to demonstrate this sequence of CA/Install/CA

This is trivial exercise at this point, but getting here was a pain in the arse!

Cheers!

DdoubleD 315 Posting Shark

No one can compete with me in this field as sknake stated :)

At first I thought, "How arrogant." But, then I realized, it's true, "No one [wants to] compete with [him] in this field..." ;) Installers seem to be a lonely bunch. Anyway, I'm sure serkan will be glad to help you with ALL your install questions. Cheers!

DdoubleD 315 Posting Shark

That's how I originally started thinking it as an example, then I scrapped it figuring it wasn't practical for using the list, but don't really know exactly how it will be used anyway:

public class FieldValues
        {
            public int Row { get; set; }
            public string FldName { get; set; }
            public object FldRowValue { get; set; } // don't know its type yet

            public FieldValues(int row, string fldName, object value)
            {
                Row = row;
                FldName = fldName;
                FldRowValue = value;
            }
        }
        List<FieldValues> fieldValues = new List<FieldValues>();

        public void AddAnItem(int row, string fldName, object value)
        {
            fieldValues.Add(new FieldValues(row, fldName, value));
        }

DeOiD, be sure to check back periodically for some other's opinions too.

Cheers!

DdoubleD 315 Posting Shark
DdoubleD 315 Posting Shark

Right click on Setup project; choose View / User Interface

In UI, Right click on Start category, choose Add Dialog

In Add Dialog, double click on desired template (just select one if you have never done this before; easy to delete from your UI and then repeat to select a different one...practice doing this

In UI, select the dialog you added (or right click and choose properties). In the properties, this is where you customize the dialog.

I will try to locate a good link explaining this setup.

DdoubleD 315 Posting Shark

Here is an example of how you could build a dynamic table to hold your data. The field names and data types are up to you to decide, etc.:

public void BuildDynamicTableArrayExample()
        {
            DataTable dt = new DataTable(); // table to hold each record
            dt.Columns.Add(new DataColumn("FieldName1", typeof(string))); // Create a string column dynamically
            dt.Columns.Add(new DataColumn("FieldName2", typeof(int))); // create an int column dyn
            dt.Columns.Add(new DataColumn("FieldName3", typeof(double))); // create a double column dyn
            for (int r = 0; r < 10; r++) // generate 10 rows of data
            {
                DataRow dr = dt.NewRow();   // create a row object of table's type defined above

                dr["FieldName1"] = "data " + r; // add some data...
                dr["FieldName2"] = r;
                dr["FieldName3"] = (double)r;

                dt.Rows.Add(dr); // add the row to the table
            }
        }
DeOiD commented: very good example +3
DdoubleD 315 Posting Shark

Did I say anywhere C# was better?
Better in computer languages does not exist, for instance I find this language not bad;)

I was about to say something practical, then I read your link and lost it--:D

DdoubleD 315 Posting Shark

i wonder it, because i hate c++ header files. if c# compiler has a way of getting rid of them, why cant c++ do?
here some similar info but i am not satisfied.
http://stackoverflow.com/questions/1305947/why-does-c-need-a-separate-header-file

This is a C/CPP forum question disguised as a C# question--flag as bad post! :P

DdoubleD 315 Posting Shark

oops, sorry. Try using: new SolidBrush(e.CellStyle.ForeColor) as the param.

DdoubleD 315 Posting Shark

Is any of this chatter related to something I said? :$

DdoubleD 315 Posting Shark

I cannot tell from the code statements why you are getting the error. I suggest you zip up the project and attach.

serkan sendur commented: i agree +10
DdoubleD 315 Posting Shark

Maybe apply the current ForeColor ?:

e.Graphics.DrawString(Convert.ToString(e.FormattedValue), e.CellStyle.Font, e.CellStyle.ForeColor, e.CellBounds.X, e.CellBounds.Y - 2, StringFormat.GenericDefault)
DdoubleD 315 Posting Shark

excuse me ?

This code allows you to pass the URL of the file you want to download from the web, along with a local path where to save the file, then will call a messagebox when completed, but you can do a shutdown when that event is called instead of MessageBox:

public static void Test()
        {
            DownloadFile dlf = new DownloadFile();
            //string url = @"http://www.daniweb.com/alphaimages/misc/logo/logo.gif";
            string url = @"http://upload.wikimedia.org/wikipedia/commons/thumb/7/75/Wikimedia_Community_Logo.svg/30px-Wikimedia_Community_Logo.svg.png";
            dlf.Download(url, @"c:\temp");
        }
        void Download(string url, string targetDir)
        {

            // Create an instance of WebClient
            WebClient client = new WebClient();

            // Hookup DownloadFileCompleted Event
            client.DownloadFileCompleted +=
                new AsyncCompletedEventHandler(client_DownloadFileCompleted);

            Uri uri = new Uri(url);
            string fileName = System.IO.Path.GetFileName(uri.LocalPath);
            string destFile = System.IO.Path.Combine(targetDir, fileName);

            try
            {
                // Start the download and copy the file to c:\temp
                client.DownloadFileAsync(uri, destFile);
            }
            catch (WebException e)
            {
                MessageBox.Show(e.Message);
            }
            catch (InvalidOperationException e)
            {
                MessageBox.Show(e.Message);
            }
        }

        void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            MessageBox.Show("File downloaded. OK to shutdown now...");
        }
sknake commented: Thats neat. I don't think i will mention how I have been downloading files :P +15
DdoubleD 315 Posting Shark

Why not have your application perform the download instead of monitoring another application?

DdoubleD 315 Posting Shark
// in Window1 button click
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Window2 window2 = new Window2();
            window2.Show();
            this.Close();
        }
DdoubleD 315 Posting Shark

I think you are in the wrong forum.... but, try this link and search the page for "calendar control": http://www.asp.net/learn/data-access/tutorial-12-cs.aspx

DdoubleD 315 Posting Shark
// inside your UserControlGame (note I changed your array to begin with lowercase s char)
        Microsoft.VisualBasic.PowerPacks.OvalShape[] slotForm = new Microsoft.VisualBasic.PowerPacks.OvalShape[GlobalVariables.configsetup[0]];

        public Microsoft.VisualBasic.PowerPacks.OvalShape[] SlotForm
        {
            get
            {
                return slotForm; // returns ref to your array
            }
            set
            {
                slotForm = value; // sets your array to a new ref
            }
        }

// usage from within MindMasterColourForm class

        Microsoft.VisualBasic.PowerPacks.OvalShape ovalShape = ugc.SlotForm[i]; // access one of the array items...
DdoubleD 315 Posting Shark

Just use path.Split('\\', StringSplitOptions.RemoveEmptyEntries) .

This did not compile on my machine... so I modified it somewhat:

string path = "C:\\test\another\\directory\\";
            char[] charSeparators = { '\\' };
            string[] subPaths = path.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
DdoubleD 315 Posting Shark

thanks hope it works but ...I am getting Error : 'Image' is a 'namespace' but is used like a 'type' how to get rid of this ??

cya
Rohan

Which line gives you that error?

DdoubleD 315 Posting Shark

OK, I am really tired, but here is a quick fix for your needing to check the comboboxes to see if they have changed. This has been out here a few days and you probably need to get it fixed soon, right

string cbCheckIText, cbStartText, cbEndText;
        private void Configuration_Load(object sender, EventArgs e)
        {
            StreamReader fileread = File.OpenText("C:\\Documents and Settings\\tanfx\\Desktop\\Configuration\\Config.txt");
            {
                TBNewP.Clear();
                Text = fileread.ReadLine();
                CBStart.SelectedItem = cbStartText = fileread.ReadLine();
                Text = fileread.ReadLine();
                CBEnd.SelectedItem = cbEndText = fileread.ReadLine();
                Text = fileread.ReadLine();
                CBCheckI.SelectedItem = cbCheckIText = fileread.ReadLine();
                Text = fileread.ReadLine();
                TBImageL.Text = fileread.ReadLine();
                Text = fileread.ReadLine();
                TBDatabaseL.Text = fileread.ReadLine();
            }
        }

// then, where you do your checks:
        private void BTNCancel_Click(object sender, EventArgs e)
        {
            //Detect if there is changes in TBConfirmP||TBNewP||TBImageL||TBDatabaseL||CBCheckI||CBStart||CBEnd
            //Show Dialogue

            // COMMENT: I've never used this propery (Modified), but I'll assume it works...
            if ((TBConfirmP.Modified == true)|| (TBNewP.Modified == true)  || (TBImageL.Modified == true) || (TBDatabaseL.Modified == true) || //(CBCheckI)|| (CBStart) || (CBEnd)
                cbCheckIText != (string)CBCheckI.SelectedItem ||
                cbEndText != (string)CBEnd.SelectedItem ||
                cbStartText != (string)CBStart.SelectedItem)
            {
  ...

I think you will understand that. There are a number of ways to accomplish your goal, but as I said I am tired and you probably need to get it working so I hope this helps.

DdoubleD 315 Posting Shark

thanks for your help...but where should i give the path of the folder ?? or how to write it ?

List<Image> images = new List<Image>();
            DirectoryInfo di = new DirectoryInfo(@"c:\myimages"); // give path
            FileInfo[] finfos = di.GetFiles("*.jpg", SearchOption.TopDirectoryOnly);
            foreach (FileInfo fi in finfos)
                images.Add(Image.FromFile(fi.FullName));