Click here to Skip to main content
15,903,012 members
Home / Discussions / C#
   

C#

 
GeneralRe: Accessing HashTable at ButtonClick Level Pin
mrfalk10-Jul-12 11:14
mrfalk10-Jul-12 11:14 
There is not really a "requirement" for me to use a Hashtable; it's just what I know how to use. I need to read the csv file and then have the user enter their ein number and then I pass back basic demographic information for user confirmation.

What are the advantages of using a generic Dictionary instead of a Hashtable?

I'm sure what I am doing is not best practices and I'm sure I'll cringe looking back at this program at some point in the future Smile | :)

Below is my work-in-progress code...

Thanks for taking the time to review my question and providing any feedback!



C#
public partial class Form1 : Form
    {

        //hashtable for empData
        Hashtable empData = new Hashtable();

        public Form1()
        {
            InitializeComponent();

            //variables for pulling data from data array

            string fName = "";
            string mName = "";
            string lName = "";
            string userProfile = "";
            string userEIN = "";

            using (CsvReader csv = new CsvReader(new StreamReader(@"C:\temp\test.csv"), true))
            {

                int fieldCount = csv.FieldCount;
                string[] headers = csv.GetFieldHeaders();
                //put data into an array....
                string[] data = new string[csv.FieldCount];


                while (csv.ReadNextRecord())
                {

                    //data put into array
                    csv.CopyCurrentRecordTo(data);


                    //rtv data from array

                    fName = data[1];
                    mName = data[2];
                    lName = data[3];
                    userProfile = data[5];
                    userEIN = data[11];


                    string concatData = (fName + "," + mName + "," + lName + "," + userProfile.ToLower());


                    //put data into hash table

                    empData.Add(userEIN, concatData);

                }//end while

            }


        }// end Form1



        private void button1_Click(object sender, EventArgs e)
        {
            //user entered ok - 

            string saveEIN = userEIN.Text;

            //retrieve demographic values from has table by ein number provided
           //Display demo data from hashtable to have user confirm identity

            string hashData = empData[saveEIN].ToString();




            //store profile used to login for copy process later
            //not working
            string userName = WindowsIdentity.GetAnonymous().Name;

          
        }


    }

SuggestionRe: Accessing HashTable at ButtonClick Level Pin
Matt T Heffron10-Jul-12 14:22
professionalMatt T Heffron10-Jul-12 14:22 
GeneralRe: Accessing HashTable at ButtonClick Level Pin
mrfalk11-Jul-12 10:46
mrfalk11-Jul-12 10:46 
QuestionQuestion... loading unmanaged dll in x64 system Pin
Blubbo9-Jul-12 9:25
Blubbo9-Jul-12 9:25 
AnswerRe: Question... loading unmanaged dll in x64 system Pin
Ian Shlasko9-Jul-12 9:51
Ian Shlasko9-Jul-12 9:51 
GeneralRe: Question... loading unmanaged dll in x64 system Pin
Luc Pattyn9-Jul-12 10:38
sitebuilderLuc Pattyn9-Jul-12 10:38 
Generalodd Custom control size issue Pin
Blubbo9-Jul-12 6:37
Blubbo9-Jul-12 6:37 
GeneralRe: odd Custom control size issue Pin
Pete O'Hanlon9-Jul-12 7:20
mvePete O'Hanlon9-Jul-12 7:20 
GeneralRe: odd Custom control size issue Pin
Blubbo9-Jul-12 8:09
Blubbo9-Jul-12 8:09 
GeneralRe: odd Custom control size issue Pin
Pete O'Hanlon9-Jul-12 8:51
mvePete O'Hanlon9-Jul-12 8:51 
AnswerRe: odd Custom control size issue Pin
Luc Pattyn9-Jul-12 8:58
sitebuilderLuc Pattyn9-Jul-12 8:58 
QuestionAnimation on ContentPresenter ContenSource Changed Pin
ezazazel9-Jul-12 4:16
ezazazel9-Jul-12 4:16 
QuestionHow to return a DataSet reuslt from LINQ class Pin
Ahmed_Worke9-Jul-12 3:57
Ahmed_Worke9-Jul-12 3:57 
QuestionExcel line-column combination chart using C#. Pin
Member 91698878-Jul-12 21:10
Member 91698878-Jul-12 21:10 
AnswerRe: Excel line-column combination chart using C#. Pin
dan!sh 8-Jul-12 22:07
professional dan!sh 8-Jul-12 22:07 
GeneralRe: Excel line-column combination chart using C#. Pin
Member 91698878-Jul-12 22:58
Member 91698878-Jul-12 22:58 
GeneralRe: Excel line-column combination chart using C#. Pin
dan!sh 8-Jul-12 23:19
professional dan!sh 8-Jul-12 23:19 
Questionexcel chart Pin
Member 91698878-Jul-12 20:23
Member 91698878-Jul-12 20:23 
AnswerRe: excel chart Pin
Abhinav S8-Jul-12 20:30
Abhinav S8-Jul-12 20:30 
GeneralRe: excel chart Pin
Member 91698878-Jul-12 20:57
Member 91698878-Jul-12 20:57 
QuestionExpire Sessions via Session Id in ASP.Net C#? Pin
Mohammad Dayyan8-Jul-12 19:29
Mohammad Dayyan8-Jul-12 19:29 
AnswerRe: Expire Sessions via Session Id in ASP.Net C#? Pin
Abhinav S8-Jul-12 20:07
Abhinav S8-Jul-12 20:07 
GeneralRe: Expire Sessions via Session Id in ASP.Net C#? Pin
Mohammad Dayyan8-Jul-12 20:31
Mohammad Dayyan8-Jul-12 20:31 
AnswerRe: Expire Sessions via Session Id in ASP.Net C#? Pin
Pete O'Hanlon10-Jul-12 23:42
mvePete O'Hanlon10-Jul-12 23:42 
QuestionException in VideoStreamGetFrameOpen Pin
Anandagowda8-Jul-12 16:25
Anandagowda8-Jul-12 16:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.