Hi ALL I'm having trouble figuring out..

I have one BTNCANCEL here and cmb1,cmb2,cm3, tb1,tb2.

How do i program so that it detect changes in cmb1,cmb2,cm3, tb1,tb2 and then when i click BTN cancel it will PROMPT to save yes/no [which i have already programed] if there is a change in either one of this[cmb1,cmb2,cm3, tb1,tb2] in runtime. and the program will close if there is no changes.

with reference to stored value in text file data.
[when I debug, the value stored in text file is displayed in cmb1,cmb2,cmb3,tb1,tb2]

So i would like to know how to do a program to BTNCANCEL_Click
that when it detected changes:

if (detect change)
{
using (SaveSetting settings = new SaveSetting())
                {
                    //read properties from dialogue
                    //when dialogue is yes it will run save and exit application
                    if (settings.ShowDialog() == DialogResult.Yes)
                    {
                        save();
                        Application.Exit();
                    }
                }

              }
else
{
   Close();
}
}

Recommended Answers

All 28 Replies

There's events detect that
TextBox | TextChanged
ComboBox | SelectedIndexChanged

Push initial values to an array,

....
 arr[0]=cmb1.Text;
 ....

Detect changes,

if(ar[0]!=cmd1.Text ......) {
    // statements
}

Hi ALL I'm having trouble figuring out..

I have one BTNCANCEL here and cmb1,cmb2,cm3, tb1,tb2.

How do i program so that it detect changes in cmb1,cmb2,cm3, tb1,tb2 and then when i click BTN cancel it will PROMPT to save yes/no (which i have already programed) if there is a change in either one of this[cmb1,cmb2,cm3, tb1,tb2] in runtime. and the program will close if there is no changes.

with reference to stored value in text file data.
(when I debug, the value stored in text file is displayed in cmb1,cmb2,cmb3,tb1,tb2)

So i would like to know how to do a program to BTNCANCEL_Click
that when it detected changes:

if (detect change)
{
using (SaveSetting settings = new SaveSetting())
                {
                    //read properties from dialogue
                    //when dialogue is yes it will run save and exit application
                    if (settings.ShowDialog() == DialogResult.Yes)
                    {
                        save();
                        Application.Exit();
                    }
                }

              }
else
{
   Close();
}
}

end quote.

i found an easier way but does anyone know how to detect combo box selected item change??

//if any of the textbox is modified
            if ((TBCurrentP.Modified == true) || (TBImageL.Modified == true) || (TBDatabaseL.Modified == true))
            {
                if (TBNewP.Text != TBConfirmP.Text)
                {
                    MessageBox.Show("The two passwords that you entered do not match.");
                }

                else
                {
                    //calling method save
                    save();                        
                    this.Close();
                 }
             }

              else             
              Close();
            }
}

LOL! did you read my reply??!!

There's events detect that
TextBox | TextChanged
ComboBox | SelectedIndexChanged

LOL! did you read my reply??!!

haas i did. but i dun get it? actually my programming sucks pretty much if not for school work=p sorry for that=X

On the ComboBox double click, VS created a handler for index changed event copy and paste your code, and solve any error if exists..

This is what the event wiring for combobox selection change should look like in case you don't use VS designer:

// in form intialization:
            this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);

// then, just create this method for your form:
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            // to retrieve it's index:
            int index = comboBox1.SelectedIndex;
            /// if your item is text, otherwise cast to proper type:
            string text = (string)comboBox1.SelectedItem;
        }

LOL! did you read my reply??!!

OO but the function i want on it actually happen only when i click BTNOK?

as in when i click BTNOK, it detect changes and save else close no saving etc.

now what i have done is i detected that the text box is changed and it will save. but i duno how to go about doing that for just combo box.

cos if i use the event handler i duno how do i go about linking it with the btn?

This is what the event wiring for combobox selection change should look like in case you don't use VS designer:

// in form intialization:
            this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);

// then, just create this method for your form:
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            // to retrieve it's index:
            int index = comboBox1.SelectedIndex;
            /// if your item is text, otherwise cast to proper type:
            string text = (string)comboBox1.SelectedItem;
        }

hello=) i think it run withins the form?
but how do i make it so like:

when i click BTNOK it will run the program which will a check if any textbox or any combo boxes[selecteditem] have change as compare to the data store. then it will run save program.

so it's like doing a check when BTN OK is click.

That depends on how you are binding the controls. If you used a typed DataSet it retains the original value for the field so you could compare those. What are you binding with?

That depends on how you are binding the controls. If you used a typed DataSet it retains the original value for the field so you could compare those. What are you binding with?

I'm just comparing with the value of the selected item in combo boxes which is stored in text file??

Are you using an OleDb datasource with the text schreiber driver, or are you parsing it manually and populating the values with code?

hello=) i think it run withins the form?
but how do i make it so like:

when i click BTNOK it will run the program which will a check if any textbox or any combo boxes[selecteditem] have change as compare to the data store. then it will run save program.

so it's like doing a check when BTN OK is click.

I wrote this for your button cancel, but you can apply this logic anywhere in your program:

private void btnCancel_Click(object sender, EventArgs e)
        {
            bool bEditChange = false;
            
            if ("whatever was read from text file" != (string)comboBox1.SelectedItem)
                bEditChange = true;

            if ("whatever was read from text file" != textBox1.Text)
                bEditChange = true;

            // etc.,etc.,etc.

            if (bEditChange)
            {
                if (DialogResult.Yes == MessageBox.Show("Save Changes?", "Cancel", MessageBoxButtons.YesNo))
                {
                    // do your file save stuff
                }
            }
        }

Are you using an OleDb datasource with the text schreiber driver, or are you parsing it manually and populating the values with code?

Hi sorry for late reply. I suppose oledb datasource? data store in microsoft access.

I wrote this for your button cancel, but you can apply this logic anywhere in your program:

private void btnCancel_Click(object sender, EventArgs e)
        {
            bool bEditChange = false;
            
            if ("whatever was read from text file" != (string)comboBox1.SelectedItem)
                bEditChange = true;

            if ("whatever was read from text file" != textBox1.Text)
                bEditChange = true;

            // etc.,etc.,etc.

            if (bEditChange)
            {
                if (DialogResult.Yes == MessageBox.Show("Save Changes?", "Cancel", MessageBoxButtons.YesNo))
                {
                    // do your file save stuff
                }
            }
        }

Oo but how do i get the data to compare because i actually use stream writer to save the item selected into the textfile=/ ???

You compare it the exact same way you stored it into the text file with stream writer. Use stream reader to read the contents of the file and compare or compare selected indexes before they are written.

I don't understand what you haven't understood in the solution.
Handle the events generated by Combo Box and Text Box, when they are changed. Flag some value. When Button is clicked, check the flag and perform action.

I don't understand what you haven't understood in the solution.
Handle the events generated by Combo Box and Text Box, when they are changed. Flag some value. When Button is clicked, check the flag and perform action.

How about that~ cause I'm not familiar with programming.Duh~ and i nv deal with combo box which is why until i still don't understand.................

facadie, if you will post the code you thus far, I will help you. Please add comments to the code in the areas that you still have questions about too.

facadie, if you will post the code you thus far, I will help you. Please add comments to the code in the areas that you still have questions about too.

My Program is actually quite messy and weird~
as you can see.. and it seems to work~ erm ya and i have a lot of doubts=( and thanks for offering help because I struggling over here

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO; //create objects for writing text to a file
using System.Security.Cryptography; 

//HOW TO CREATE DATBASE AS MY TBPassword is to be store in microsoft access & have it encrypted.
//I have created Password.mdb

namespace Configuration
{
    public partial class Configuration : Form
    {

        public Configuration()
        {
            InitializeComponent();
        }

        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 = fileread.ReadLine();
                Text = fileread.ReadLine();
                CBEnd.SelectedItem = fileread.ReadLine();
                Text = fileread.ReadLine();
                CBCheckI.SelectedItem = fileread.ReadLine();
                Text = fileread.ReadLine();
                TBImageL.Text = fileread.ReadLine();
                Text = fileread.ReadLine();
                TBDatabaseL.Text = fileread.ReadLine();
            }


        }




        private void BTNCancel_Click(object sender, EventArgs e)
        {
            //Detect if there is changes in TBConfirmP||TBNewP||TBImageL||TBDatabaseL||CBCheckI||CBStart||CBEnd
            //BLUR about how to detect changes in Combo Boxes and implement.

            //Show Dialogue

            if ((TBConfirmP.Modified == true)|| (TBNewP.Modified == true)  || (TBImageL.Modified == true) || (TBDatabaseL.Modified == true)) //(CBCheckI)|| (CBStart) || (CBEnd)
            {

                {
                    //Display MessageBox to save changes.
                    if (MessageBox.Show("Do you want to save the changes made to Configuration?", "Save Your Setting", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) 

                    {
                        //Check if NewPassword entered and Confirm Password entered match
                        //Save when Password Matches.
                        if (TBNewP.Text == TBConfirmP.Text)
                        {
                            save();
                            this.Close();
                        }
                        else
                        {
                            //Display Message Box
                            //Clear New Password & Confirm Password for re-enter.
                            MessageBox.Show("Your Confirm Password does not match with New Password. Please re-enter your password.");
                            TBNewP.Text = "";
                            TBConfirmP.Text = "";
                        }
                    }
                    else 
                        Close();
                }

                //form will disposed of here automatically
              }
            else
              Close();
          
        }


        private void BTNOK_Click(object sender, EventArgs e)
        {
            //Detect if there is modification in TBConfirmP||TBNewP||TBImageL||TBDatabaseL||CBCheckI||CBStart||CBEnd
            //Validation for TBConfirm, TBNewP, TBImageL,TBDatabaseL
            //TBConfirm & TBNewP [at least 7 Characters]
            //TBDatabaseL & TBImageL [cannot be empty]
            
            if ((TBConfirmP.Modified == true) || (TBNewP.Modified == true) || (TBImageL.Modified == true) || (TBDatabaseL.Modified == true)) //(CBCheckI.Modified == true)|| (CBStart.Modified == true) || (CBEnd.Modified == true))
                { 
                        //PROBLEM here is that it does not show the error provider even though it run the statement.
                        errorProvider1.Clear();
                        bool hasErrors = false;
                        if (string.IsNullOrEmpty(TBDatabaseL.Text))
                        {
                            errorProvider1.SetError(TBDatabaseL, "Please enter a directory");
                            hasErrors = true;
                        }
                        if (string.IsNullOrEmpty(TBImageL.Text))
                        {
                            errorProvider1.SetError(TBImageL, "Please enter a directory");
                            hasErrors = true;
                        }
                    

                    if ((TBConfirmP.Modified == true) ||(TBNewP.Modified==true))
                    {
                        //Clear and re-check all controls
                        //errorProvider1.Clear();
                        //bool hasErrors = false;
                        if (TBNewP.Text.Length < 7)
                        {
                            errorProvider1.SetError(TBNewP, "You must enter at least 7 characters");
                            hasErrors = true;
                        }

                        if (TBConfirmP.Text.Length < 7)
                        {
                            errorProvider1.SetError(TBConfirmP, "You must enter at least 7 characters");
                            hasErrors = true;
                        }

                        if (!hasErrors)
                        {
                            //Check if Password enter matches
                            //Display MessageBox
                            if (TBNewP.Text != TBConfirmP.Text)
                            {
                                MessageBox.Show("The New Password and Confirm Passwords that you entered do not match. Please Re-Enter");
                                TBNewP.Text = "";
                                TBConfirmP.Text = "";
                            }
                            else
                            {
                                //calling method save
                                save();
                                //close this Application after saving
                                this.Close();
                            }
                        }
                    
                }
                else
                {
                    save();
                    this.Close();
                }
             }
             else          
             Close();
        }   

  
        private void save()
        {
                 //To create and overwrite textfile details that is inserted
                StreamWriter fileSW = File.CreateText("C:\\Documents and Settings\\tanfx\\Desktop\\Configuration\\Config.txt");
                fileSW.WriteLine("[Start Monitoring]");                
                //value selected in combo box is save and overwrite
                fileSW.WriteLine(CBStart.SelectedItem);
                fileSW.WriteLine("[EndMonitoring]");
                fileSW.WriteLine(CBEnd.SelectedItem);
                fileSW.WriteLine("[Check Intervals]");
                fileSW.WriteLine(CBCheckI.SelectedItem);
                //fileSW.WriteLine(TBCurrentP.Text);
                //fileSW.WriteLine(TBNewP.Text);
                //fileSW.WriteLine(TBConfirmP.Text);
                fileSW.WriteLine("[Image Location]");
                fileSW.WriteLine(TBImageL.Text);
                fileSW.WriteLine("[DataBase Location]");
                fileSW.WriteLine(TBDatabaseL.Text);

                fileSW.Close();
        }

        private void BTNReset_Click(object sender, EventArgs e)
        {
            StreamReader fileread = File.OpenText("C:\\Documents and Settings\\tanfx\\Desktop\\Configuration\\Config.txt");
            {
                TBNewP.Clear();
                TBConfirmP.Clear();
                Text = fileread.ReadLine();
                CBStart.SelectedItem = fileread.ReadLine();
                Text = fileread.ReadLine();
                CBEnd.SelectedItem = fileread.ReadLine();
                Text = fileread.ReadLine();
                CBCheckI.SelectedItem = fileread.ReadLine();
                //TBCurrentP must refer to database to set to whatever store in database
                Text = fileread.ReadLine();
                TBImageL.Text = fileread.ReadLine();
                Text = fileread.ReadLine();
                TBDatabaseL.Text = fileread.ReadLine();

            }
        }

        private void TBConfirmP_TextChanged(object sender, EventArgs e)
        {
            errorProvider1.SetError((sender as Control), string.Empty);
        }

        private void TBDatabaseL_TextChanged(object sender, EventArgs e)
        {
            errorProvider1.SetError((sender as Control), string.Empty);
        }

        private void TBImageL_TextChanged(object sender, EventArgs e)
        {
            errorProvider1.SetError((sender as Control), string.Empty);
        }

        private void TBCurrentP_TextChanged(object sender, EventArgs e)
        {
            errorProvider1.SetError((sender as Control), string.Empty);
        }

        private void TBNewP_TextChanged(object sender, EventArgs e)
        {
            errorProvider1.SetError((sender as Control), string.Empty);
        }


    }
}

You need to post the designer code too: "Configuration.designer.cs" file.

Messy you say? I've seen much, much worse! No worries.

You need to post the designer code too: "Configuration.designer.cs" file.

Messy you say? I've seen much, much worse! No worries.

haas to me it's pretty messy=x

namespace Configuration
{
    partial class Configuration
    {
        /// <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.TBConfirm = new System.Windows.Forms.TextBox();
            this.TBNew = new System.Windows.Forms.TextBox();
            this.TBCurrentP = new System.Windows.Forms.TextBox();
            this.TBNewP = new System.Windows.Forms.TextBox();
            this.GBAdmin = new System.Windows.Forms.GroupBox();
            this.TBCurrent = new System.Windows.Forms.TextBox();
            this.TBConfirmP = new System.Windows.Forms.TextBox();
            this.TBChkInterval = new System.Windows.Forms.TextBox();
            this.BTNCancel = new System.Windows.Forms.Button();
            this.BTNOK = new System.Windows.Forms.Button();
            this.BTNReset = new System.Windows.Forms.Button();
            this.TBStart = new System.Windows.Forms.TextBox();
            this.TBEnd = new System.Windows.Forms.TextBox();
            this.GBMonitor = new System.Windows.Forms.GroupBox();
            this.CBStart = new System.Windows.Forms.ComboBox();
            this.CBEnd = new System.Windows.Forms.ComboBox();
            this.TBImage = new System.Windows.Forms.TextBox();
            this.TBDatabase = new System.Windows.Forms.TextBox();
            this.TBImageL = new System.Windows.Forms.TextBox();
            this.TBDatabaseL = new System.Windows.Forms.TextBox();
            this.CBCheckI = new System.Windows.Forms.ComboBox();
            this.TBs = new System.Windows.Forms.TextBox();
            this.GBAdmin.SuspendLayout();
            this.GBMonitor.SuspendLayout();
            this.SuspendLayout();
            // 
            // TBConfirm
            // 
            this.TBConfirm.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.TBConfirm.Location = new System.Drawing.Point(39, 84);
            this.TBConfirm.Name = "TBConfirm";
            this.TBConfirm.ReadOnly = true;
            this.TBConfirm.Size = new System.Drawing.Size(100, 13);
            this.TBConfirm.TabIndex = 2;
            this.TBConfirm.Text = "Confirm Password";
            // 
            // TBNew
            // 
            this.TBNew.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.TBNew.Location = new System.Drawing.Point(39, 58);
            this.TBNew.Name = "TBNew";
            this.TBNew.ReadOnly = true;
            this.TBNew.Size = new System.Drawing.Size(100, 13);
            this.TBNew.TabIndex = 3;
            this.TBNew.Text = "New Password";
            // 
            // TBCurrentP
            // 
            this.TBCurrentP.Location = new System.Drawing.Point(145, 29);
            this.TBCurrentP.Name = "TBCurrentP";
            this.TBCurrentP.Size = new System.Drawing.Size(121, 20);
            this.TBCurrentP.TabIndex = 4;
            this.TBCurrentP.UseSystemPasswordChar = true;
            // 
            // TBNewP
            // 
            this.TBNewP.Location = new System.Drawing.Point(145, 55);
            this.TBNewP.Name = "TBNewP";
            this.TBNewP.Size = new System.Drawing.Size(121, 20);
            this.TBNewP.TabIndex = 5;
            this.TBNewP.UseSystemPasswordChar = true;
            // 
            // GBAdmin
            // 
            this.GBAdmin.Controls.Add(this.TBCurrent);
            this.GBAdmin.Controls.Add(this.TBConfirmP);
            this.GBAdmin.Controls.Add(this.TBNew);
            this.GBAdmin.Controls.Add(this.TBNewP);
            this.GBAdmin.Controls.Add(this.TBCurrentP);
            this.GBAdmin.Controls.Add(this.TBConfirm);
            this.GBAdmin.Location = new System.Drawing.Point(12, 108);
            this.GBAdmin.Name = "GBAdmin";
            this.GBAdmin.Size = new System.Drawing.Size(330, 121);
            this.GBAdmin.TabIndex = 6;
            this.GBAdmin.TabStop = false;
            this.GBAdmin.Text = "Adminstrator";
            // 
            // TBCurrent
            // 
            this.TBCurrent.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.TBCurrent.Location = new System.Drawing.Point(39, 32);
            this.TBCurrent.Name = "TBCurrent";
            this.TBCurrent.ReadOnly = true;
            this.TBCurrent.Size = new System.Drawing.Size(100, 13);
            this.TBCurrent.TabIndex = 7;
            this.TBCurrent.Text = "Current Password";
            // 
            // TBConfirmP
            // 
            this.TBConfirmP.Location = new System.Drawing.Point(145, 81);
            this.TBConfirmP.Name = "TBConfirmP";
            this.TBConfirmP.PasswordChar = '*';
            this.TBConfirmP.Size = new System.Drawing.Size(121, 20);
            this.TBConfirmP.TabIndex = 6;
            this.TBConfirmP.UseSystemPasswordChar = true;
            // 
            // TBChkInterval
            // 
            this.TBChkInterval.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.TBChkInterval.Location = new System.Drawing.Point(51, 84);
            this.TBChkInterval.Name = "TBChkInterval";
            this.TBChkInterval.ReadOnly = true;
            this.TBChkInterval.Size = new System.Drawing.Size(100, 13);
            this.TBChkInterval.TabIndex = 7;
            this.TBChkInterval.Text = "Checking Intervals:";
            // 
            // BTNCancel
            // 
            this.BTNCancel.Location = new System.Drawing.Point(134, 320);
            this.BTNCancel.Name = "BTNCancel";
            this.BTNCancel.Size = new System.Drawing.Size(75, 23);
            this.BTNCancel.TabIndex = 8;
            this.BTNCancel.Text = "Cancel";
            this.BTNCancel.UseVisualStyleBackColor = true;
            this.BTNCancel.Click += new System.EventHandler(this.BTNCancel_Click);
            // 
            // BTNOK
            // 
            this.BTNOK.Location = new System.Drawing.Point(26, 320);
            this.BTNOK.Name = "BTNOK";
            this.BTNOK.Size = new System.Drawing.Size(75, 23);
            this.BTNOK.TabIndex = 9;
            this.BTNOK.Text = "OK";
            this.BTNOK.UseVisualStyleBackColor = true;
            this.BTNOK.Click += new System.EventHandler(this.BTNOK_Click);
            // 
            // BTNReset
            // 
            this.BTNReset.Location = new System.Drawing.Point(242, 320);
            this.BTNReset.Name = "BTNReset";
            this.BTNReset.Size = new System.Drawing.Size(75, 23);
            this.BTNReset.TabIndex = 10;
            this.BTNReset.Text = "Reset";
            this.BTNReset.UseVisualStyleBackColor = true;
            this.BTNReset.Click += new System.EventHandler(this.BTNReset_Click);
            // 
            // TBStart
            // 
            this.TBStart.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.TBStart.Location = new System.Drawing.Point(14, 22);
            this.TBStart.Name = "TBStart";
            this.TBStart.ReadOnly = true;
            this.TBStart.Size = new System.Drawing.Size(31, 13);
            this.TBStart.TabIndex = 11;
            this.TBStart.Text = "Start";
            this.TBStart.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            // 
            // TBEnd
            // 
            this.TBEnd.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.TBEnd.Location = new System.Drawing.Point(171, 22);
            this.TBEnd.Name = "TBEnd";
            this.TBEnd.ReadOnly = true;
            this.TBEnd.Size = new System.Drawing.Size(26, 13);
            this.TBEnd.TabIndex = 12;
            this.TBEnd.Text = "End";
            this.TBEnd.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            // 
            // GBMonitor
            // 
            this.GBMonitor.Controls.Add(this.CBStart);
            this.GBMonitor.Controls.Add(this.CBEnd);
            this.GBMonitor.Controls.Add(this.TBStart);
            this.GBMonitor.Controls.Add(this.TBEnd);
            this.GBMonitor.Location = new System.Drawing.Point(12, 12);
            this.GBMonitor.Name = "GBMonitor";
            this.GBMonitor.Size = new System.Drawing.Size(330, 54);
            this.GBMonitor.TabIndex = 13;
            this.GBMonitor.TabStop = false;
            this.GBMonitor.Text = "Monitoring Time";
            // 
            // CBStart
            // 
            this.CBStart.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.CBStart.Items.AddRange(new object[] {
            "08:00",
            "09:00",
            "10:00",
            "11:00",
            "12:00",
            "13:00",
            "14:00",
            "15:00",
            "16:00",
            "17:00",
            "18:00",
            "19:00",
            "20:00",
            "21:00",
            "22:00",
            "23:00"});
            this.CBStart.Location = new System.Drawing.Point(51, 19);
            this.CBStart.Name = "CBStart";
            this.CBStart.Size = new System.Drawing.Size(114, 21);
            this.CBStart.TabIndex = 16;
            // 
            // CBEnd
            // 
            this.CBEnd.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.CBEnd.FormattingEnabled = true;
            this.CBEnd.Items.AddRange(new object[] {
            "User Log Out",
            "08:00",
            "09:00",
            "10:00",
            "11:00",
            "12:00",
            "13:00",
            "14:00",
            "15:00",
            "16:00",
            "17:00",
            "18:00",
            "19:00",
            "20:00",
            "21:00",
            "22:00",
            "23:00"});
            this.CBEnd.Location = new System.Drawing.Point(203, 19);
            this.CBEnd.Name = "CBEnd";
            this.CBEnd.Size = new System.Drawing.Size(114, 21);
            this.CBEnd.TabIndex = 15;
            // 
            // TBImage
            // 
            this.TBImage.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.TBImage.Location = new System.Drawing.Point(26, 245);
            this.TBImage.Name = "TBImage";
            this.TBImage.ReadOnly = true;
            this.TBImage.Size = new System.Drawing.Size(100, 13);
            this.TBImage.TabIndex = 14;
            this.TBImage.Text = "Image Location";
            // 
            // TBDatabase
            // 
            this.TBDatabase.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.TBDatabase.Location = new System.Drawing.Point(26, 274);
            this.TBDatabase.Name = "TBDatabase";
            this.TBDatabase.ReadOnly = true;
            this.TBDatabase.Size = new System.Drawing.Size(100, 13);
            this.TBDatabase.TabIndex = 15;
            this.TBDatabase.Text = "Database Location";
            // 
            // TBImageL
            // 
            this.TBImageL.Location = new System.Drawing.Point(132, 242);
            this.TBImageL.Name = "TBImageL";
            this.TBImageL.Size = new System.Drawing.Size(128, 20);
            this.TBImageL.TabIndex = 16;
            // 
            // TBDatabaseL
            // 
            this.TBDatabaseL.Location = new System.Drawing.Point(132, 268);
            this.TBDatabaseL.Name = "TBDatabaseL";
            this.TBDatabaseL.Size = new System.Drawing.Size(128, 20);
            this.TBDatabaseL.TabIndex = 17;
            // 
            // CBCheckI
            // 
            this.CBCheckI.AutoCompleteCustomSource.AddRange(new string[] {
            "30",
            "60",
            "90",
            "120",
            "150",
            "180",
            "210",
            "240",
            "270",
            "300"});
            this.CBCheckI.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.CBCheckI.FormattingEnabled = true;
            this.CBCheckI.Items.AddRange(new object[] {
            "30",
            "60",
            "90",
            "120",
            "150",
            "180",
            "210",
            "240",
            "270",
            "300"});
            this.CBCheckI.Location = new System.Drawing.Point(157, 81);
            this.CBCheckI.Name = "CBCheckI";
            this.CBCheckI.Size = new System.Drawing.Size(121, 21);
            this.CBCheckI.TabIndex = 18;
            // 
            // TBs
            // 
            this.TBs.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.TBs.Location = new System.Drawing.Point(284, 84);
            this.TBs.Name = "TBs";
            this.TBs.ReadOnly = true;
            this.TBs.Size = new System.Drawing.Size(45, 13);
            this.TBs.TabIndex = 19;
            this.TBs.Text = "s";
            // 
            // Configuration
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(352, 378);
            this.Controls.Add(this.TBs);
            this.Controls.Add(this.CBCheckI);
            this.Controls.Add(this.TBDatabaseL);
            this.Controls.Add(this.TBImageL);
            this.Controls.Add(this.TBDatabase);
            this.Controls.Add(this.TBImage);
            this.Controls.Add(this.GBMonitor);
            this.Controls.Add(this.BTNReset);
            this.Controls.Add(this.BTNOK);
            this.Controls.Add(this.BTNCancel);
            this.Controls.Add(this.TBChkInterval);
            this.Controls.Add(this.GBAdmin);
            this.Name = "Configuration";
            this.Text = "Configuration";
            this.Load += new System.EventHandler(this.Configuration_Load);
            this.GBAdmin.ResumeLayout(false);
            this.GBAdmin.PerformLayout();
            this.GBMonitor.ResumeLayout(false);
            this.GBMonitor.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.TextBox TBConfirm;
        private System.Windows.Forms.TextBox TBNew;
        private System.Windows.Forms.TextBox TBCurrentP;
        private System.Windows.Forms.TextBox TBNewP;
        private System.Windows.Forms.GroupBox GBAdmin;
        private System.Windows.Forms.TextBox TBConfirmP;
        private System.Windows.Forms.TextBox TBChkInterval;
        private System.Windows.Forms.Button BTNCancel;
        private System.Windows.Forms.Button BTNOK;
        private System.Windows.Forms.Button BTNReset;
        private System.Windows.Forms.TextBox TBStart;
        private System.Windows.Forms.TextBox TBEnd;
        private System.Windows.Forms.GroupBox GBMonitor;
        private System.Windows.Forms.TextBox TBImage;
        private System.Windows.Forms.TextBox TBDatabase;
        private System.Windows.Forms.TextBox TBImageL;
        private System.Windows.Forms.TextBox TBDatabaseL;
        private System.Windows.Forms.ComboBox CBStart;
        private System.Windows.Forms.ComboBox CBEnd;
        private System.Windows.Forms.ComboBox CBCheckI;
        private System.Windows.Forms.TextBox TBCurrent;
        private System.Windows.Forms.TextBox TBs;
    }
}

Still missing definition for errorProvider1 object.. Is there another file I need to get this to compile?

Still missing definition for errorProvider1 object.. Is there another file I need to get this to compile?

erm I'm not so sure maybe program.cs??

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.

Push initial values to an array,

....
 arr[0]=cmb1.Text;
 ....

Detect changes,

if(ar[0]!=cmd1.Text ......) {
    // statements
}

as in?

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.

yeap i did. thanks=)

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.

yeap i did. thanks=)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.