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
B

bwood2020

@bwood2020
About
Posts
44
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • SSRS Visibility Option
    B bwood2020

    Hi all, I am trying to hide a table in my report if all the text values are null. I am running the expression =iif(IsNothing(Fields!LoanType.Value), true, false) but this seems to hide the table no matter what. I have also tried the Len function but this doesn't work either. The Table in the database is set to allow nulls for this attribute. Here is an example of two tables I have in the report. Example dataset1: Conventional FHA VA null Expression used:=iif(IsNothing(Fields!LoanType.Value), true, false) Example Dataset2: null Expression used:=iif(IsNothing(Fields!Assumable.Value), true, false) When I apply the above functions both tables are hidden. However, the table holding example datset1 shouldn't be hidden and example dataset2 should be.

    Database database sql-server tutorial

  • Passing a Method to a second form
    B bwood2020

    Hi Henry, It does and I tried to aply the same logic but it wasn't working. The code I used to get this to work was differnt. I think it had to do with adding another event handler to take care of it.

    C# help

  • Passing a Method to a second form
    B bwood2020

    Thank you for your reply. That works perfectly.

    C# help

  • Passing a Method to a second form
    B bwood2020

    No offense taken. I'm new to C# programming. Usually work with SQL. Thanks for the input!

    C# help

  • Passing a Method to a second form
    B bwood2020

    I tried it without the Form1 MainForm = new Form1(); code but it gives an error NullReferenceException. How can I get around this?

    C# help

  • Passing a Method to a second form
    B bwood2020

    Hi all, I am having problems passing a method from form 1 to form 2. I have on form 1 a dgv and a button. When the form 1 button is clicked it takes me to form 2. On form 2 I have the same set up, a dgv and a button. However, the button on Form 2, when clicked should call a method from form 1 then closes form 2. When I run the windows form application I get no errors. The method on form 1 that I try to call from form 2 is public. Any help is much appreciated. Thank you! Code: Form 1 public void UpdateGridView()             {                // Method code             } form 2 public void MapFormUpdate_Click(object sender, EventArgs e)             {                   Form1 MainForm = new Form1();                   MainForm.UpdateGridView();                   this.Close();               }

    C# help

  • Multiple forms and datagridviews
    B bwood2020

    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

    C# database question

  • Multiple forms and datagridviews
    B bwood2020

    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

    C# database question

  • Multiple forms and datagridviews
    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!

    C# database question

  • Multiple forms and datagridviews
    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!!!

    C# database question

  • Multiple forms and datagridviews
    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

    C# database question

  • Multiple forms and datagridviews
    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))

    C# database question

  • Multiple forms and datagridviews
    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.

    C# database question

  • Multiple forms and datagridviews
    B bwood2020

    Hi Henry, have a good weekend? I copied the code into two forms but I'm getting an error in the collection code you sent over. The errors I'm getting are: 1. expected { 2. Invalid token '>' in class, struct, or interface member declaration. The error occurs at: public class FieldMappingDictionary : Dictionary> I placed this code outside the public partial class ListEditorForm : Form. Should I place this code somewhere else? Also, looks like I have a couple of things coming down the pipe today so I may be fairly busy today. Just want you to know incase you don't hear back from me until later today. Thank you, Brenton Brenton

    C# database question

  • Multiple forms and datagridviews
    B bwood2020

    Looking into this now...

    C# database question

  • Multiple forms and datagridviews
    B bwood2020

    No, there could be up to 30+ different doc types. I just used three for this example. Same goes for the other fields we need to map data for. Not all possible data is known until we receive the data and the same client doesn't always give us the same headings or file formats. nothing is considered finite between the data or the headers. The reason for the multiple dgv's is to have a dgv per field where the data needs to be mapped. So, dgv1 is for Doc Types, dgv2 is for Purpose Types, dgv3 is for Occupancy Types and so on. So the second part of the third paragraph you wrote is correct "or to summarize (dgv1 = doctype, with a row for count of full doc, another for count of limited doc etc) with the other dgvs for the other field types". So the all the dgv's have three columns. The first will be the column that gets populated with the data from the file or the dgv on Form 1(example Full Documentation). The second column is a combo dropdown that contains the new code (F for Full Documentation). The third is a count of how many loans have Full Documentation. After all Doc Types have been recoded, then dgv on Form 1 needs to be updated. For example, Full Documentation is will be updated to F. Once the dgv on Form 1 has been updated with the new codes from form 2, I will output it to excel for our SSIS (this is done and has been tested).

    C# database question

  • Multiple forms and datagridviews
    B bwood2020

    That is correct, with one exception. The only thing I want to accomplish in Form 1 is changing the field headers to a standardized naming convention. In Form 2 I want to standardize the data (but this only needs to be done to certain fields like Doc types). I will explain more to you so we are both on the same page. So we receive files on a daily basis from many different clients. These files contain different information in different columns with different field headers. We use SSIS to get them into our systems however, SSIS breaks every time we run the files through because of the differentiation between field headers and data. So, to get around this I am creating a prototype to standardize all the files which mainly include field headers and data related to some of the fields (i.e. Doc Type, Purpose Type, and so on). So For example, if the field header Doc Type comes in then in form 1 row 1 of the dgv there is a combo dropdown where the user can select the "New" header name. Then the second form needs to include the distinct data for the specific field headers so I can standardize them as well. This second form will activate upon clicking a button. Example: File 1: Loan Documentation Type(field name from file) = DocType(new header that will be selected in row 1 of the dgv on Form1) Low Doc, Full, and No Doc(Doc Types data from file) = L, F, ND(translate doc types to standardized naming convention in dgv on Form 2) File 2: Docs(field name from file) = DocType(new header that will be selected in row 1 of the dgv on Form1) 1, 2, and 3 (data from file) = L, F, ND(translate doc types to standardized naming convention in dgv on Form 2) So the files we get have 100's of loans. For this example, the field Doc Types can have many types (i.e. 50 Full docs, 25 Low Docs, and 25 No docs) which is why I would like to select Distinct values only having to map, in this case, 3 doc types rather then 100. I am sure I have not explained myself very well in previous posts so please let me know if you need additional information or if you are confused on anything I have said to this point.

    C# database question

  • Multiple forms and datagridviews
    B bwood2020

    I am still confused because I would still have to know what the field names are called in the file. For instance, I have 2 files. One file may have 32 fields and the other 10 fields which come in different days (say one today and one tomorrow). In these columns we are looking for Loan Purpose Type and Loan Documentation type. In file one these fields are named Doc Type and Purp Type and in the second file they are named Documentation Type and Purpose Type. Also, in the where clause you would need to specify all the doc types. However, each client has there own doc types. One client may have say Full Doc, Limited Doc, and No Doc. Another client may have 1, 2, and 3. so it seems the query would have to change every time. Is this correct?

    C# database question

  • Multiple forms and datagridviews
    B bwood2020

    Hi Henry, I have tried to pass dataKey.Cells[c].Value a couple of ways but I am not having any luck. Here are just three ways I have tried that make sense to me but aren't working: dataGridView1.DataSource = dataKey.Cells[c].Value; dataGridView1.Rows.Add(dataKey.Cells[c].Value); dataGridView1.SelectedRows[c].Cells[c].Value = dataKey.Cells[c].Value; I have also tried adding ToString() to the end of Value and that isn't working either. I have spent a good amount of time doing research on how to pass the values of the cells to the dgv and I haven't found anything that would work. Do you have a little more time to help me out on this? Thank you, Brenton

    C# database question

  • Multiple forms and datagridviews
    B bwood2020

    Thanks Henry for the short run down of your concerns. I will look into this... I agree with you about renaming the controls as descriptive as possible. As soon as I get this last part I will go back through and rename them. I implemented the code you wrote and I get the error 'System.Windows.Forms.DataGridViewRow' does not contain a definition for 'Columns'. This occurs at 'this.dataKey.Columns.Count' in the for loop on Form 2. I have tried looking this up and I get similar hits but what I have tried doesn't work. Any ideas?

    C# database question
  • Login

  • Don't have an account? Register

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