Click here to Skip to main content
15,907,183 members
Home / Discussions / C#
   

C#

 
AnswerRe: Subscript Characters? [modified] Pin
BillWoodruff18-Dec-09 12:00
professionalBillWoodruff18-Dec-09 12:00 
QuestionHashtable with Structure or Class Object Pin
Bruce Coward16-Dec-09 0:37
Bruce Coward16-Dec-09 0:37 
AnswerRe: Hashtable with Structure or Class Object Pin
Richard MacCutchan16-Dec-09 0:50
mveRichard MacCutchan16-Dec-09 0:50 
GeneralRe: Hashtable with Structure or Class Object Pin
Bruce Coward16-Dec-09 1:06
Bruce Coward16-Dec-09 1:06 
GeneralRe: Hashtable with Structure or Class Object Pin
Richard MacCutchan16-Dec-09 1:20
mveRichard MacCutchan16-Dec-09 1:20 
GeneralRe: Hashtable with Structure or Class Object Pin
Bruce Coward16-Dec-09 1:26
Bruce Coward16-Dec-09 1:26 
GeneralRe: Hashtable with Structure or Class Object Pin
Richard MacCutchan16-Dec-09 1:46
mveRichard MacCutchan16-Dec-09 1:46 
GeneralRe: Hashtable with Structure or Class Object Pin
Bruce Coward16-Dec-09 2:08
Bruce Coward16-Dec-09 2:08 
Hi Richard,

Thank you for your continuing patience...

I have spent quite a time with that link yesterday and am happy with it's basic message. I appreciate that string is only a class but my problem comes when I try to build my small class and store it in the Hashtable. I can do that and by single stepping I can see my two data records be added to the hashtable. I notice that the hashtable seems to add both records but put the second records data over the first hash position as well as the second hash posotion but I haven't chased that problem yet.

My real problem comes when I try to recover the records when I am not getting the data back. Here is my code:

namespace ConsoleApplication7
{
    class Program
    {
        class csFPRec
        {
            public UInt32 uiPGN;
            public UInt32 uiFrameCtr;
        }
        
        static void Main(string[] args)
        {
            // Instantiate Class
            csFPRec FPRec = new csFPRec();
            Hashtable HT = new Hashtable();
 
            Console.WriteLine("Writing Initial Records");
            
            Console.WriteLine("Writing 0x1234");
            FPRec.uiPGN = 0x1234;
            FPRec.uiFrameCtr = 0x01;
            HT.Add(FPRec.uiPGN, FPRec);
            
            Console.WriteLine("Writing 0x5678");
            FPRec.uiPGN = 0x5678;
            FPRec.uiFrameCtr = 0x02;
            HT.Add(FPRec.uiPGN, FPRec);
            
            Console.WriteLine();
            Console.WriteLine("Reading Records");

            // Get record back from Hashtable
            object pgnobj = new object();
            pgnobj = HT[0x1234];


            Console.ReadLine();
        }
    }
}


As you can tell I am a newbie with C# having been writing embedded C for more than 20 years.

Best regards
AnswerRe: Hashtable with Structure or Class Object Pin
Estys16-Dec-09 2:28
Estys16-Dec-09 2:28 
GeneralRe: Hashtable with Structure or Class Object Pin
Bruce Coward16-Dec-09 2:37
Bruce Coward16-Dec-09 2:37 
GeneralRe: Hashtable with Structure or Class Object Pin
Bruce Coward16-Dec-09 3:02
Bruce Coward16-Dec-09 3:02 
GeneralRe: Hashtable with Structure or Class Object [modified] Pin
Estys16-Dec-09 3:10
Estys16-Dec-09 3:10 
GeneralRe: Hashtable with Structure or Class Object Pin
Bruce Coward16-Dec-09 3:25
Bruce Coward16-Dec-09 3:25 
QuestionSilverlight Control interactions with WinForms Pin
softwarejaeger16-Dec-09 0:31
softwarejaeger16-Dec-09 0:31 
QuestionBackup of the application data [modified] Solved Pin
NarendraSinghJTV16-Dec-09 0:17
NarendraSinghJTV16-Dec-09 0:17 
AnswerRe: Backup of the application data Pin
Saksida Bojan16-Dec-09 2:42
Saksida Bojan16-Dec-09 2:42 
GeneralRe: Backup of the application data Pin
NarendraSinghJTV16-Dec-09 23:39
NarendraSinghJTV16-Dec-09 23:39 
GeneralRe: Backup of the application data Pin
Saksida Bojan17-Dec-09 4:02
Saksida Bojan17-Dec-09 4:02 
GeneralRe: Backup of the application data Pin
NarendraSinghJTV18-Dec-09 1:45
NarendraSinghJTV18-Dec-09 1:45 
QuestionTrying To Create A Data Access Layer Pin
Roger Wright15-Dec-09 19:17
professionalRoger Wright15-Dec-09 19:17 
AnswerRe: Trying To Create A Data Access Layer Pin
Saksida Bojan15-Dec-09 20:37
Saksida Bojan15-Dec-09 20:37 
GeneralRe: Trying To Create A Data Access Layer Pin
0x3c015-Dec-09 21:06
0x3c015-Dec-09 21:06 
GeneralRe: Trying To Create A Data Access Layer Pin
Roger Wright16-Dec-09 6:51
professionalRoger Wright16-Dec-09 6:51 
AnswerRe: Trying To Create A Data Access Layer Pin
0x3c015-Dec-09 21:06
0x3c015-Dec-09 21:06 
GeneralRe: Trying To Create A Data Access Layer Pin
Saksida Bojan15-Dec-09 22:44
Saksida Bojan15-Dec-09 22:44 

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.