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
P

polomint

@polomint
About
Posts
10
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Problem with List<>
    P polomint

    Damn, I knew it would be something trivial... Thanks for waking me up to a silly mistake, :-D :-D :-D EDIT: Now I'm getting the error "cannot have instance field initializers in structs"... Hmmm, this could be a pain... EDIT AGAIN: I realised what was wrong.. I hadn't been initialising the sGamePortItem in the list..

    sGamePortItem pi = new sGamePortItem();
    pi.sgpPortList = new List<sGamePort>(); // THIS WAS NEEDED.

    Thank you for your help, it made me think more about the initialisation...

    Yippee Kai Yai Signed Polomint.......

    modified on Thursday, December 3, 2009 2:09 PM

    .NET (Core and Framework) help csharp dotnet data-structures question

  • Problem with List&lt;&gt;
    P polomint

    Hi, I have a problem with VS2010beta2 and .NET Framework Client Profile, although I would expect the problem to be something to do with my inexperienced coding. I have this block of code..

        struct sGamePort
        {
            public string sgpProtocol;
            public UInt16 sgpPortStart;
            public UInt16 sgpPortEnd;
        }
    
        struct sGamePortItem
        {
            public string sgpName;
            public List<sGamePort> sgpPortList;
        }
    
        List<sGamePortItem> sGames;
    
    
        private sGamePort ParsePorts(string\[\] line)
        {
            sGamePort gp = new sGamePort();
            gp.sgpProtocol = line\[0\];
            int num = line.Count();
            if (num == 2)
            {
                // single port opened...
                gp.sgpPortStart =  Convert.ToUInt16(line\[1\]);
                gp.sgpPortEnd = Convert.ToUInt16(line\[1\]);
            }
            if (num == 3)
            {
                // port range opened...
                gp.sgpPortStart = Convert.ToUInt16(line\[1\]);
                gp.sgpPortEnd = Convert.ToUInt16(line\[2\]);
            }
            return gp;
        }
    

    Where line is a string array which essentially holds some tokens. ie. line[0] = "NAME" line[1] = "JOHN" line[2] = "YOUNG" Now, in a seperate function I have

    sGamePortItem pi = new sGamePortItem();
    pi.sgpProtocol = "TCP";
    pi.sgpPortList.Add(ParsePorts(strCMD));

    This gives me a Null Reference Exception, so I changed it to this...

    sGamePortItem pi = new sGamePortItem();
    pi.sgpProtocol = "TCP";
    sGamePort test = new sGamePort();
    test = ParsePorts(strCMD);
    pi.sgpPortList.Add(test); // ERROR HERE

    Now, the error only occurs on the specified line above.. What am I doing wrong? Is it to do with me using the new keyword incorrectly? Or do I not use 'new'? Any help would be appreciated as this has been confusing me for a few hours now, lol Thanks again. John

    Yippee Kai Yai Signed Polomint.......

    .NET (Core and Framework) help csharp dotnet data-structures question

  • Intrumented versions of applications?
    P polomint

    Thanks, I'll take a look now...

    Yippee Kai Yai Signed Polomint.......

    .NET (Core and Framework) question help

  • Intrumented versions of applications?
    P polomint

    Hi everyone, A quick question if i may? I have been looking for a while for a way of logging all activity in my application by the user. I believe it is called instrumentation but I may be wrong. This is mainly so that when a user finds a problem with the software then I am able to playback exactly what they did. This will also allow me to see how the application is used by different users. Does anyone know a way to do this? Links to further reading or maybe even links to software that I could use to do this would be appreciated.. In the meantime, I shall keep looking :) Thanks again...

    Oh oh... Signed Polomint.......

    .NET (Core and Framework) question help

  • Integrating the Media Player
    P polomint

    Damn, my post was hijacked by Anonymous !!!! :-D I've just checked for the controls property and I do have it. wmp.Controls( int index ); I assume that the index is the index of the play/pause controls etc. Are you using Visual Studio? I use VS2003, and all I do is add the Windows Media Player COM component to the toolbox, then use it. HTH John Yippee Kai Yai Signed Polomint.......

    C# csharp com help question learning

  • Integrating the Media Player
    P polomint

    I'm not sure but I think the you may use the property 'uiMode'. Valid values are "none", "mini", and "full"... eg... wmp1.uiMode = "none"; Also.. If you don't want the context menu for the Windows Media Control , use wmp1.enableContextMenu = false; // true to turn it back on Hope that helps.. Yippee Kai Yai Signed Polomint.......

    C# csharp com help question learning

  • Usin Invoke with threads
    P polomint

    Damn, I should have read the code properly. I never noticed the delegate. I've always been impatient. :) Thanks again.. Yippee Kai Yai Signed Polomint.......

    C# design question

  • Usin Invoke with threads
    P polomint

    Ok, I understand what you are both saying. Would this work? Also the line Add a = new Add(StringAdder); has me confused. What is add? The compiler complains about me missing a Using directive. string s; s = "Timeout"; Add a = new Add(StringAdder); IAsyncResult ar = a.BeginInvoke(s, null, null); //lbLog.Items.Add(s); Thanks again. PS: What about things like listBox1.Items.Clear() etc... Yippee Kai Yai Signed Polomint.......

    C# design question

  • Usin Invoke with threads
    P polomint

    I have a piece of code which runs in another thread (not the UI thread). // listBox1.Items.Add(s); // But because listBox1 was created in another thread, VS2005 does not allow me to do this. I have been told that I need to use BeginInvoke or Invoke on the control to add the item. Does anyone have any ideas on how I would code that? I need to pass a string which will hold the new string to add listBox1. Thanks in advance. John Young Yippee Kai Yai Signed Polomint.......

    C# design question

  • Visual C# Express 2005
    P polomint

    I also have them both on my laptop. They seem to work fine. Although I also tried them both on my desktop which they proceeded to screw up my system. Moral of this story - use Virtual PC and install beta versions inside that... HTH John Young Yippee Kai Ya... Signed Polomint.......

    C# csharp visual-studio 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