Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Multiple forms and datagridviews

Multiple forms and datagridviews

Scheduled Pinned Locked Moved C#
databasequestion
50 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B bwood2020

    Sorry Henry, That is what I have and is giving the error. There are no '& gt;' or '& lt;' in the code. That must have happend when I copied and paste it into the reply. The error is occuring at public class FieldMappingDictionary : Dictionary>. I tried Dictionary <string, string> but it didn't work.

    H Offline
    H Offline
    Henry Minute
    wrote on last edited by
    #37

    Here it is again. This time I'll try to paste it properly.   :) <pre>      public class FieldMappingDictionary : Dictionary<string, List<string>>      {           public void Add(string key, string value)           {                // if the key is already in the list                if (base.Keys.Contains(key))                {                     // only do it if not already there                     if (!base[key].Contains(value))                     {                          // add the new value                          base[key].Add(value);                     }                }                else                {                     // if the key ain't there, add it and a new values list                     List<string> list = new List<string>();                     list.Add(value);                     base.Add(key, list);                }           }      } </pre>

    Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?

    B 1 Reply Last reply
    0
    • H Henry Minute

      Here it is again. This time I'll try to paste it properly.   :) <pre>      public class FieldMappingDictionary : Dictionary<string, List<string>>      {           public void Add(string key, string value)           {                // if the key is already in the list                if (base.Keys.Contains(key))                {                     // only do it if not already there                     if (!base[key].Contains(value))                     {                          // add the new value                          base[key].Add(value);                     }                }                else                {                     // if the key ain't there, add it and a new values list                     List<string> list = new List<string>();                     list.Add(value);                     base.Add(key, list);                }           }      } </pre>

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?

      B Offline
      B Offline
      bwood2020
      wrote on last edited by
      #38

      Hi Henry, Almost there! I have one more problem. I am getting the error: 'System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>>.KeyCollection' does not contain a definition for 'Contains' This occurs on line 6: if (base.Keys.Contains(key))

      H 2 Replies Last reply
      0
      • B bwood2020

        Hi Henry, Almost there! I have one more problem. I am getting the error: 'System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>>.KeyCollection' does not contain a definition for 'Contains' This occurs on line 6: if (base.Keys.Contains(key))

        H Offline
        H Offline
        Henry Minute
        wrote on last edited by
        #39

        I keep forgetting that you are using VS2005. Slight modification: <pre>      public class FieldMappingDictionary : Dictionary<string, List<string>>      {           public void Add(string key, string value)           {                // if the key is already in the list                if (this.KeysContains(key)) // <================= Modified Line                {                     // only do it if not already there                     if (!base[key].Contains(value))                     {                          // add the new value                          base[key].Add(value);                     }                }                else                {                     // if the key ain't there, add it and a new values list                     List<string> list = new List<string>();                     list.Add(value);                     base.Add(key, list);                }           }           public bool KeysContains(string key) // <=========== New Method, just iterates over keys collection, returns true if

        1 Reply Last reply
        0
        • B bwood2020

          Hi Henry, Almost there! I have one more problem. I am getting the error: 'System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>>.KeyCollection' does not contain a definition for 'Contains' This occurs on line 6: if (base.Keys.Contains(key))

          H Offline
          H Offline
          Henry Minute
          wrote on last edited by
          #40

          Incidentally I keep forgetting this. You could save one step in your overall scheme, if loading the modified data into Excel is not a requirement. SSIS can read XML directly, and both DataSet and DataTable have a method called WriteXML, which believe it, or not, writes their data (and/or schema) to an XML file. As I said, if the Excel step is not a requirement, simply write the data to an XML file ready for SSIS.

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

          B 1 Reply Last reply
          0
          • H Henry Minute

            Incidentally I keep forgetting this. You could save one step in your overall scheme, if loading the modified data into Excel is not a requirement. SSIS can read XML directly, and both DataSet and DataTable have a method called WriteXML, which believe it, or not, writes their data (and/or schema) to an XML file. As I said, if the Excel step is not a requirement, simply write the data to an XML file ready for SSIS.

            Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

            B Offline
            B Offline
            bwood2020
            wrote on last edited by
            #41

            Hi Henry, Looks like I have added all the code I need and the code compiles without warnings but the dgv doesn't get populated. I belive the only place I needed to add code too is here. If I am wrong then please advise further. private void ProcessMods()           {                // Create a copy of original table structure with                // standardized column names**                // load original file data into it                // then do a series of updates using the docsDictionary, and the                // other Dictionaries                // STEP THROUGH THIS TO WATCH UPDATE STATEMENT BUILDING                StringBuilder selectBuilder = null;                foreach (string key in this.docsDictionary.Keys)                {                     foreach (string val in this.docsDictionary[key])                     {                          selectBuilder = new StringBuilder();                          selectBuilder.Append("UPDATE TestData SET Documentation = ");                          selectBuilder.Append(key);                          selectBuilder.Append(" WHERE Documentation = ");                          selectBuilder.Append(val);                          str

            H 3 Replies Last reply
            0
            • B bwood2020

              Hi Henry, Looks like I have added all the code I need and the code compiles without warnings but the dgv doesn't get populated. I belive the only place I needed to add code too is here. If I am wrong then please advise further. private void ProcessMods()           {                // Create a copy of original table structure with                // standardized column names**                // load original file data into it                // then do a series of updates using the docsDictionary, and the                // other Dictionaries                // STEP THROUGH THIS TO WATCH UPDATE STATEMENT BUILDING                StringBuilder selectBuilder = null;                foreach (string key in this.docsDictionary.Keys)                {                     foreach (string val in this.docsDictionary[key])                     {                          selectBuilder = new StringBuilder();                          selectBuilder.Append("UPDATE TestData SET Documentation = ");                          selectBuilder.Append(key);                          selectBuilder.Append(" WHERE Documentation = ");                          selectBuilder.Append(val);                          str

              H Offline
              H Offline
              Henry Minute
              wrote on last edited by
              #42

              Strictly speaking ProcessMods() was intended merely, to create a copy of the table containing client-data but with your standard column names (See the comments at start of the method). I have left that bit for you to do as I am not sure about the best method for that process. Then it should process all the updates retrieved from MappingForm. You could fill the grid during that operation, but it would slow it down enormously, although it would show progress. The alternative would be to show the modifications after they are completed. In which case your dgv filling code should either be the very last thing in ProcessMods(), or immediately after the call to ProcessMods() in the MappingForm_Closed event handler (this would be my preference). For ProcessMods() the parts left to be done are, as mentioned above, copying the data to a new table with proper column names (incidentally I suggested copying so that the original data remains intact, in case of accidents. :) ), and this bit:

              // execute the query here
              // you know OleDbConnection, OleDbcommand etc.
              // then go round for next mod
              

              which is immediately above your new dgv fill code.

              bwood2020 wrote:

              Do I need to add code for a ShowDialog and capture the full path of the file?

              Yes, for the production version, you probably would. Putting the test data in the debug folder was simply for convenience for what is a demo of a concept. If you stepped through the query building bit, I hope that you could see that for each of your standardised pieces of data the method builds an update query for each of the versions the client has used. It might turn out that using a query is not the best way to perform this operation, but the point of the exercise is to show that the data required to do the mods, is in a format which will enable the changes to be done fairly easily. I am currently looking at methods for copying the client data into a table with standard column names. I'll be back with you shortly. Of course, if you already know how to do this, let me know.

              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

              1 Reply Last reply
              0
              • B bwood2020

                Hi Henry, Looks like I have added all the code I need and the code compiles without warnings but the dgv doesn't get populated. I belive the only place I needed to add code too is here. If I am wrong then please advise further. private void ProcessMods()           {                // Create a copy of original table structure with                // standardized column names**                // load original file data into it                // then do a series of updates using the docsDictionary, and the                // other Dictionaries                // STEP THROUGH THIS TO WATCH UPDATE STATEMENT BUILDING                StringBuilder selectBuilder = null;                foreach (string key in this.docsDictionary.Keys)                {                     foreach (string val in this.docsDictionary[key])                     {                          selectBuilder = new StringBuilder();                          selectBuilder.Append("UPDATE TestData SET Documentation = ");                          selectBuilder.Append(key);                          selectBuilder.Append(" WHERE Documentation = ");                          selectBuilder.Append(val);                          str

                H Offline
                H Offline
                Henry Minute
                wrote on last edited by
                #43

                Just when you thought it was safe to ......... :-D Some mods to the first form, I am posting the whole thing, because there are some renames, as well as some new methods and fields:

                	List standardList = new List();
                	Dictionary clientHeaders = new Dictionary();
                	Dictionary standardHeaders = new Dictionary();
                	DataSet testDataSet = null;
                	DataTable headerTable = null;
                	DataTable clientDataTable = null;
                	DataTable standardDataTable = null;
                	MappingForm mappingForm = null;
                	readonly string dataFile = "TestData.csv";
                
                	FieldMappingDictionary docsDictionary = null;
                
                	public ListEditorForm()
                	{
                		InitializeComponent();
                		InitStandardList();
                	}
                
                	private void InitStandardList()
                	{
                		standardList.AddRange(new string\[\] { "Property", "Offer", "Documentation", "Figures", "Guarantee" });
                	}
                
                	private void ProcessMods()
                	{
                		// Create a copy of original table structure with
                		// standardized column names\*\*
                		// load original file data into it
                		this.GetClientData();
                		this.CreateStandardTable();
                
                		// then do a series of updates using the docsDictionary, and the
                		// other Dictionaries
                		// STEP THROUGH THIS TO WATCH UPDATE STATEMENT BUILDING
                		//StringBuilder selectBuilder = null;
                		foreach (string key in this.docsDictionary.Keys)
                		{
                			foreach (string val in this.docsDictionary\[key\])
                			{
                				//selectBuilder = new StringBuilder();
                				//selectBuilder.Append("UPDATE  SET Documentation = ");
                				//selectBuilder.Append(key);
                				//selectBuilder.Append(" WHERE Documentation = ");
                				//selectBuilder.Append(val);
                
                				//string updateQuery = selectBuilder.ToString();
                
                				// execute the query here
                				// you know OleDbConnection, OleDbcommand etc.
                				// then go round for next mod
                				foreach (DataRow row in this.standardDataTable.Rows)
                				{
                					if (row\["Documentation"\].ToString() == val)
                					{
                						row\["Documentation"\] = key;
                					}
                				}
                			}
                			// go round for next key
                		}
                
                		// then do same for next dictionary
                	}
                
                	private void MakeHeaderDictionaries()
                	{
                		this.clientHeaders = this.MakeHeaderDictionary();
                		this.standardHeaders = this.MakeStandardHeaderDictionary();
                	}
                
                	private Dictionary MakeStandardHeaderDictionary()
                	{
                		Dictionary result = new Dictionary();
                		foreach (DataRow row in this.headerTable.Rows)
                		{
                			result.A
                
                1 Reply Last reply
                0
                • B bwood2020

                  Hi Henry, Looks like I have added all the code I need and the code compiles without warnings but the dgv doesn't get populated. I belive the only place I needed to add code too is here. If I am wrong then please advise further. private void ProcessMods()           {                // Create a copy of original table structure with                // standardized column names**                // load original file data into it                // then do a series of updates using the docsDictionary, and the                // other Dictionaries                // STEP THROUGH THIS TO WATCH UPDATE STATEMENT BUILDING                StringBuilder selectBuilder = null;                foreach (string key in this.docsDictionary.Keys)                {                     foreach (string val in this.docsDictionary[key])                     {                          selectBuilder = new StringBuilder();                          selectBuilder.Append("UPDATE TestData SET Documentation = ");                          selectBuilder.Append(key);                          selectBuilder.Append(" WHERE Documentation = ");                          selectBuilder.Append(val);                          str

                  H Offline
                  H Offline
                  Henry Minute
                  wrote on last edited by
                  #44

                  If I had more than two brain cells to rub together, I would have written this:

                  	void MappingForm\_Closed(object sender, FormClosingEventArgs e)
                  	{
                  		this.docsDictionary = this.MappingForm.DocumentsDictionary;
                  		// get rest of dictionaries here
                  
                  		this.ProcessMods();
                  
                  		this.testDataSet.Tables\["ClientData"\].WriteXml("ClientTestData.xml", XmlWriteMode.WriteSchema); // <==== new
                  		this.testDataSet.Tables\["StandardData"\].WriteXml("StandardTestData.xml", XmlWriteMode.WriteSchema); // <== filename changed
                  	}
                  

                  This should make it easier to compare unmodified and modified data. You should also note that the column names have been modified in the StandardTestData.xml version.

                  Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                  B 1 Reply Last reply
                  0
                  • H Henry Minute

                    If I had more than two brain cells to rub together, I would have written this:

                    	void MappingForm\_Closed(object sender, FormClosingEventArgs e)
                    	{
                    		this.docsDictionary = this.MappingForm.DocumentsDictionary;
                    		// get rest of dictionaries here
                    
                    		this.ProcessMods();
                    
                    		this.testDataSet.Tables\["ClientData"\].WriteXml("ClientTestData.xml", XmlWriteMode.WriteSchema); // <==== new
                    		this.testDataSet.Tables\["StandardData"\].WriteXml("StandardTestData.xml", XmlWriteMode.WriteSchema); // <== filename changed
                    	}
                    

                    This should make it easier to compare unmodified and modified data. You should also note that the column names have been modified in the StandardTestData.xml version.

                    Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                    B Offline
                    B Offline
                    bwood2020
                    wrote on last edited by
                    #45

                    Henry, This is great! Very well organized and I like the idea of having the ability to contain the integrity of the original data set. I also like the idea of outputting to an xml file as well as comparing both the original data set to the standardized data set. I did have to modify some of the code you sent over. I had to add <string> to List and <string, string> to the Dictionaries. Let me know if this is not correct and I will go back through and make the recommended changes. I'm still having problems populating the dgv on form 1. Maybe it's that I have not added some functionality to it. On Form 1 I added a dgv and a button name dataGridView1 and btnGetValue. On Form 2 I added a dgv and a button named dgvDocumentation and btnOK. Am I forgetting anything? I have read through the code and it compiles but just can't pinpoint what's going on. You’re the man Henry!!!

                    H 2 Replies Last reply
                    0
                    • B bwood2020

                      Henry, This is great! Very well organized and I like the idea of having the ability to contain the integrity of the original data set. I also like the idea of outputting to an xml file as well as comparing both the original data set to the standardized data set. I did have to modify some of the code you sent over. I had to add <string> to List and <string, string> to the Dictionaries. Let me know if this is not correct and I will go back through and make the recommended changes. I'm still having problems populating the dgv on form 1. Maybe it's that I have not added some functionality to it. On Form 1 I added a dgv and a button name dataGridView1 and btnGetValue. On Form 2 I added a dgv and a button named dgvDocumentation and btnOK. Am I forgetting anything? I have read through the code and it compiles but just can't pinpoint what's going on. You’re the man Henry!!!

                      H Offline
                      H Offline
                      Henry Minute
                      wrote on last edited by
                      #46

                      bwood2020 wrote:

                      I'm still having problems populating the dgv on form 1. Maybe it's that I have not added some functionality to it. On Form 1 I added a dgv and a button name dataGridView1 and btnGetValue. On Form 2 I added a dgv and a button named dgvDocumentation and btnOK. Am I forgetting anything? I have read through the code and it compiles but just can't pinpoint what's going on.

                      That sounds right. I'll go through my designer code to see if I've forgotten to tell you something obvious.

                      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                      1 Reply Last reply
                      0
                      • B bwood2020

                        Henry, This is great! Very well organized and I like the idea of having the ability to contain the integrity of the original data set. I also like the idea of outputting to an xml file as well as comparing both the original data set to the standardized data set. I did have to modify some of the code you sent over. I had to add <string> to List and <string, string> to the Dictionaries. Let me know if this is not correct and I will go back through and make the recommended changes. I'm still having problems populating the dgv on form 1. Maybe it's that I have not added some functionality to it. On Form 1 I added a dgv and a button name dataGridView1 and btnGetValue. On Form 2 I added a dgv and a button named dgvDocumentation and btnOK. Am I forgetting anything? I have read through the code and it compiles but just can't pinpoint what's going on. You’re the man Henry!!!

                        H Offline
                        H Offline
                        Henry Minute
                        wrote on last edited by
                        #47

                        Er.................. I did tell you that I had added two dgv columns, in the designer, didn't I? No, you say! ahem:

                        	private void InitializeComponent()
                        	{
                        		this.components = new System.ComponentModel.Container();
                        		this.dataGridView1 = new System.Windows.Forms.DataGridView();
                        		this.btnGetValue = new System.Windows.Forms.Button();
                        		this.clientColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
                        		this.standardColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
                        		this.headersBindingSource = new System.Windows.Forms.BindingSource(this.components);
                        		((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
                        		((System.ComponentModel.ISupportInitialize)(this.headersBindingSource)).BeginInit();
                        		this.SuspendLayout();
                        		// 
                        		// dataGridView1
                        		// 
                        		this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                        		this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn\[\] {
                                this.clientColumn,
                                this.standardColumn});
                        		this.dataGridView1.Location = new System.Drawing.Point(12, 12);
                        		this.dataGridView1.Name = "dataGridView1";
                        		this.dataGridView1.Size = new System.Drawing.Size(284, 171);
                        		this.dataGridView1.TabIndex = 0;
                        		// 
                        		// btnGetValue
                        		// 
                        		this.btnGetValue.Location = new System.Drawing.Point(154, 236);
                        		this.btnGetValue.Name = "btnGetValue";
                        		this.btnGetValue.Size = new System.Drawing.Size(75, 23);
                        		this.btnGetValue.TabIndex = 1;
                        		this.btnGetValue.Text = "Value";
                        		this.btnGetValue.UseVisualStyleBackColor = true;
                        		this.btnGetValue.Click += new System.EventHandler(this.btnGetValue\_Click);
                        		// 
                        		// clientColumn
                        		// 
                        		this.clientColumn.HeaderText = "Client Header";
                        		this.clientColumn.Name = "clientColumn";
                        		// 
                        		// standardColumn
                        		// 
                        		this.standardColumn.HeaderText = "Standard Header";
                        		this.standardColumn.Name = "standardColumn";
                        		// 
                        		// ListEditorForm
                        		// 
                        		this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);
                        		this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                        		this.ClientSize = new System.Drawing.Size(422, 288);
                        		this.Controls.Add(this.btnGetValue);
                        		this.Controls.Add(this.dataGridView1);
                        		this.Name = "ListEditorForm";
                        		this.Text = "List Editor";
                        		this.Load += new System.EventHandler(this.ListEditorForm\_Load);
                        		((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
                        		((System
                        
                        B 2 Replies Last reply
                        0
                        • H Henry Minute

                          Er.................. I did tell you that I had added two dgv columns, in the designer, didn't I? No, you say! ahem:

                          	private void InitializeComponent()
                          	{
                          		this.components = new System.ComponentModel.Container();
                          		this.dataGridView1 = new System.Windows.Forms.DataGridView();
                          		this.btnGetValue = new System.Windows.Forms.Button();
                          		this.clientColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
                          		this.standardColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
                          		this.headersBindingSource = new System.Windows.Forms.BindingSource(this.components);
                          		((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
                          		((System.ComponentModel.ISupportInitialize)(this.headersBindingSource)).BeginInit();
                          		this.SuspendLayout();
                          		// 
                          		// dataGridView1
                          		// 
                          		this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                          		this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn\[\] {
                                  this.clientColumn,
                                  this.standardColumn});
                          		this.dataGridView1.Location = new System.Drawing.Point(12, 12);
                          		this.dataGridView1.Name = "dataGridView1";
                          		this.dataGridView1.Size = new System.Drawing.Size(284, 171);
                          		this.dataGridView1.TabIndex = 0;
                          		// 
                          		// btnGetValue
                          		// 
                          		this.btnGetValue.Location = new System.Drawing.Point(154, 236);
                          		this.btnGetValue.Name = "btnGetValue";
                          		this.btnGetValue.Size = new System.Drawing.Size(75, 23);
                          		this.btnGetValue.TabIndex = 1;
                          		this.btnGetValue.Text = "Value";
                          		this.btnGetValue.UseVisualStyleBackColor = true;
                          		this.btnGetValue.Click += new System.EventHandler(this.btnGetValue\_Click);
                          		// 
                          		// clientColumn
                          		// 
                          		this.clientColumn.HeaderText = "Client Header";
                          		this.clientColumn.Name = "clientColumn";
                          		// 
                          		// standardColumn
                          		// 
                          		this.standardColumn.HeaderText = "Standard Header";
                          		this.standardColumn.Name = "standardColumn";
                          		// 
                          		// ListEditorForm
                          		// 
                          		this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);
                          		this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                          		this.ClientSize = new System.Drawing.Size(422, 288);
                          		this.Controls.Add(this.btnGetValue);
                          		this.Controls.Add(this.dataGridView1);
                          		this.Name = "ListEditorForm";
                          		this.Text = "List Editor";
                          		this.Load += new System.EventHandler(this.ListEditorForm\_Load);
                          		((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
                          		((System
                          
                          B Offline
                          B Offline
                          bwood2020
                          wrote on last edited by
                          #48

                          Ha-ha, you have a very good sense of humor. It makes it more fun and adds to my dull and busy day. You are correct sir. You did have that. I am looking through Form 2 and I see I need to add something else to get this to work. One down and one to go. I will follow up with you tomorrow. Thanks again Henry and have a good night!

                          B 1 Reply Last reply
                          0
                          • B bwood2020

                            Ha-ha, you have a very good sense of humor. It makes it more fun and adds to my dull and busy day. You are correct sir. You did have that. I am looking through Form 2 and I see I need to add something else to get this to work. One down and one to go. I will follow up with you tomorrow. Thanks again Henry and have a good night!

                            B Offline
                            B Offline
                            bwood2020
                            wrote on last edited by
                            #49

                            Hi Henry, I was extremely busy yesterday but I was able to work on this demo for about an hour. As it turns out I am having difficulties getting the second form to work. I looked through the code again and saw that I was missing a combobox so I added that to the dgv; however this didn't fix the issue. Can you send the designer code for the second form when you get a chance please? Thank you, Brenton

                            1 Reply Last reply
                            0
                            • H Henry Minute

                              Er.................. I did tell you that I had added two dgv columns, in the designer, didn't I? No, you say! ahem:

                              	private void InitializeComponent()
                              	{
                              		this.components = new System.ComponentModel.Container();
                              		this.dataGridView1 = new System.Windows.Forms.DataGridView();
                              		this.btnGetValue = new System.Windows.Forms.Button();
                              		this.clientColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
                              		this.standardColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
                              		this.headersBindingSource = new System.Windows.Forms.BindingSource(this.components);
                              		((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
                              		((System.ComponentModel.ISupportInitialize)(this.headersBindingSource)).BeginInit();
                              		this.SuspendLayout();
                              		// 
                              		// dataGridView1
                              		// 
                              		this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                              		this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn\[\] {
                                      this.clientColumn,
                                      this.standardColumn});
                              		this.dataGridView1.Location = new System.Drawing.Point(12, 12);
                              		this.dataGridView1.Name = "dataGridView1";
                              		this.dataGridView1.Size = new System.Drawing.Size(284, 171);
                              		this.dataGridView1.TabIndex = 0;
                              		// 
                              		// btnGetValue
                              		// 
                              		this.btnGetValue.Location = new System.Drawing.Point(154, 236);
                              		this.btnGetValue.Name = "btnGetValue";
                              		this.btnGetValue.Size = new System.Drawing.Size(75, 23);
                              		this.btnGetValue.TabIndex = 1;
                              		this.btnGetValue.Text = "Value";
                              		this.btnGetValue.UseVisualStyleBackColor = true;
                              		this.btnGetValue.Click += new System.EventHandler(this.btnGetValue\_Click);
                              		// 
                              		// clientColumn
                              		// 
                              		this.clientColumn.HeaderText = "Client Header";
                              		this.clientColumn.Name = "clientColumn";
                              		// 
                              		// standardColumn
                              		// 
                              		this.standardColumn.HeaderText = "Standard Header";
                              		this.standardColumn.Name = "standardColumn";
                              		// 
                              		// ListEditorForm
                              		// 
                              		this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);
                              		this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                              		this.ClientSize = new System.Drawing.Size(422, 288);
                              		this.Controls.Add(this.btnGetValue);
                              		this.Controls.Add(this.dataGridView1);
                              		this.Name = "ListEditorForm";
                              		this.Text = "List Editor";
                              		this.Load += new System.EventHandler(this.ListEditorForm\_Load);
                              		((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
                              		((System
                              
                              B Offline
                              B Offline
                              bwood2020
                              wrote on last edited by
                              #50

                              Hi Henry, Thank you for sending me the demo. Even though I was not able to get it to work, I was able to get my app working by dissecting the code you wrote. I'm sorry I caused you frustration and thank you again for helping me on this. I will close this out now and give you the rating you deserve. Thanks again, Brenton

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups