Click here to Skip to main content
15,913,758 members
Home / Discussions / C#
   

C#

 
GeneralRe: HTML vs. GDI Pin
VengefulSakhmet28-Jul-09 3:00
VengefulSakhmet28-Jul-09 3:00 
QuestionDataGridView text string Pin
hotracerj27-Jul-09 10:29
hotracerj27-Jul-09 10:29 
AnswerRe: DataGridView text string [modified] Pin
ricmil4227-Jul-09 10:49
ricmil4227-Jul-09 10:49 
Questionlist add method Pin
Charlesh327-Jul-09 10:25
Charlesh327-Jul-09 10:25 
GeneralRe: list add method [modified] Pin
musefan27-Jul-09 10:30
musefan27-Jul-09 10:30 
AnswerRe: list add method Pin
DaveyM6927-Jul-09 11:11
professionalDaveyM6927-Jul-09 11:11 
GeneralRe: list add method Pin
musefan27-Jul-09 11:19
musefan27-Jul-09 11:19 
AnswerRe: list add method Pin
DaveyM6927-Jul-09 11:19
professionalDaveyM6927-Jul-09 11:19 
Ah, I think I may have it. Is the error:
Invalid token '(' in class, struct, or interface member declaration?

If so, it's because you can't add to the list outside of a method.
Wrong:
public class MyClass
{
    List<CUserMem> MemoryBank = new List<CUserMem>(10);
    CUserMem TempCUserMem = new CUserMem();
    // This linext line will not compile.
    MemoryBank.Add(TempCUserMem);
}
Correct:
public class MyClass
{
    List<CUserMem> MemoryBank = new List<CUserMem>(10);

    public MyClass()
    {
        // Doing it in constructor, but could be anywhere
        CUserMem TempCUserMem = new CUserMem();
        AddToList(TempCUserMem);
    }

    void AddToList(CUserMem userMem)
    {
        MemoryBank.Add(userMem);
    }
}


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus)

GeneralRe: list add method Pin
musefan27-Jul-09 11:20
musefan27-Jul-09 11:20 
GeneralRe: list add method Pin
DaveyM6927-Jul-09 13:17
professionalDaveyM6927-Jul-09 13:17 
GeneralRe: list add method Pin
Charlesh327-Jul-09 11:46
Charlesh327-Jul-09 11:46 
GeneralRe: list add method Pin
DaveyM6927-Jul-09 13:18
professionalDaveyM6927-Jul-09 13:18 
Questionencoded using the 16-bit UCS-2 character Pin
Flex.Me27-Jul-09 7:43
Flex.Me27-Jul-09 7:43 
AnswerRe: encoded using the 16-bit UCS-2 character Pin
Alan N27-Jul-09 9:34
Alan N27-Jul-09 9:34 
QuestionFunction to Find and Replace in C# Pin
GrgBalden27-Jul-09 6:39
GrgBalden27-Jul-09 6:39 
AnswerRe: Function to Find and Replace in C# Pin
musefan27-Jul-09 6:50
musefan27-Jul-09 6:50 
GeneralRe: Function to Find and Replace in C# Pin
GrgBalden27-Jul-09 9:08
GrgBalden27-Jul-09 9:08 
AnswerRe: Function to Find and Replace in C# Pin
musefan27-Jul-09 9:50
musefan27-Jul-09 9:50 
AnswerRe: Function to Find and Replace in C# Pin
PIEBALDconsult27-Jul-09 9:36
mvePIEBALDconsult27-Jul-09 9:36 
GeneralRe: Function to Find and Replace in C# Pin
GrgBalden27-Jul-09 9:45
GrgBalden27-Jul-09 9:45 
GeneralRe: Function to Find and Replace in C# Pin
PIEBALDconsult27-Jul-09 10:37
mvePIEBALDconsult27-Jul-09 10:37 
QuestionBlinking form when minimaze [modified] Pin
gal00027-Jul-09 6:34
gal00027-Jul-09 6:34 
AnswerRe: Blinking form when minimaze Pin
musefan27-Jul-09 6:44
musefan27-Jul-09 6:44 
AnswerRe: Blinking form when minimaze Pin
Abhijit Jana27-Jul-09 6:48
professionalAbhijit Jana27-Jul-09 6:48 
GeneralRe: Blinking form when minimaze Pin
gal00027-Jul-09 8:42
gal00027-Jul-09 8:42 

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.