wtf c#.net

Discussion in 'OT Technology' started by wabash9000, Sep 26, 2007.

  1. wabash9000

    wabash9000 Active Member

    Joined:
    Dec 27, 2006
    Messages:
    14,392
    Likes Received:
    0
    Location:
    Overland Park, KS
    Today was my first time coding in visual c#.net. I have a large project due soon and I was working on it most of the day. I saved it and exited out to install some windows updates and when I got back into the software everything that I had placed on the form was gone. All my code was still there but all of the items on the form were gone and it will no longer compile, saying that InitializeComponent(); is not a reconized command. what did I do wrong???
     
  2. CodeX

    CodeX Guest

    God I hate C# and that .net bullshit

    sorry I cant help you
     
  3. wabash9000

    wabash9000 Active Member

    Joined:
    Dec 27, 2006
    Messages:
    14,392
    Likes Received:
    0
    Location:
    Overland Park, KS
    i was liking it till this bullshit happened.
     
  4. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    never heard of this happening... corrupt file?

    i use VS2005 all day every day, and no issues here
     
  5. P00L SNIPER

    P00L SNIPER New Member

    Joined:
    Sep 23, 2007
    Messages:
    2
    Likes Received:
    0
    ok. i've been using c# for about a year now so ima see if i can help some. first. not all of your code is there. if all of your objects (button, labels, etc) on the form are not showing up in the designer window then they are definitely gone. probably the best explanation for that is you accidentally deleted something which is pretty easy to do. and i have never heard of the .net software just losing code on its own.

    now for the reason its not compiling. when looking at the code first thing is all the using directives, then the namespace, then the main class for the form, then there is an objct that is named public Form1 (Form1 will be whatever the name of ur form is). in that object the only code they have is InitializeComponent();. whenever you compile that is one of the first lines of code it will try to compile. that is the code to actually design and display ur form. that line of code InitializeComponent(); is actually calling another object that's farther down called private void InitializeComponent(). u r apparantly missing that object and that is why ur getting a compilation error.

    and it makes sense because the only code in that object deals with the properties of the objects on ur form. and by the way that block is usually automatically collapsed. if u open it u will see that all it contains is things like size and position of labels and buttons.

    so to fix ur problem u need to go and put all the buttons and labels and stuff back on ur form and make sure their code gets added to the private void InitializeComponent() block. i hope i dint confuse u too much.
     
  6. wabash9000

    wabash9000 Active Member

    Joined:
    Dec 27, 2006
    Messages:
    14,392
    Likes Received:
    0
    Location:
    Overland Park, KS
    yeah i decided that it was a bad UI anyways so I made a new solution and project remade the UI and then copied snipits of code over and changed that variables to fit the new feilds.

    the only reason that I can come up with that I lost my data is that one of the updates I did was the .net 2.0 installer for x64. Other than that I think the program just hates me.
     
  7. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    Oh, well, the mistake you made was not using a Microsoft Visual SourceSafe database to store all your code.

    Oh, you're a single user and you don't need a database? That sucks.

    :rolleyes:
     
  8. Frequency

    Frequency New Member

    Joined:
    Dec 30, 2004
    Messages:
    7,504
    Likes Received:
    0
    Location:
    PA
    Been working in c# for over 2 years now have never had this happen.
    Source Control is your friend.
    Take some time and actually go into the project folder, learn how dotNet stores all the form information and you should be able to rescue yourself from any future situations
     
  9. eskarinna

    eskarinna New Member

    Joined:
    Apr 18, 2006
    Messages:
    1,114
    Likes Received:
    0
    Location:
    Dallas

    I just :rofl: at that coment. I think when i feel sad and blue i will come back to this and read it it truly did make my day.

    back on your problem - i have been using visual studio for many many many years now, starting with classic asp, .net1.0, and now .net 2.0. I have been developing with both vb and c# .net. Never seen anything like that happen. but even if it did happen i can assure you is not C# fault, its your ide.

    Advise from one developer to another: learn the framework before you try jumping into .net programming. there is planty resources in msdn regarding the .net framework that will teach you both how it works and how to use it. Then move on to learn everything else .
     
  10. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    Doesn't it seem a little counterintuitive that you have to take a course (more or less) before you can use the product? A good product has easily-accessible functions that you can start using with minimal knowledge, and complex functions that you learn how to use after you have some firsthand experience.
     
  11. eskarinna

    eskarinna New Member

    Joined:
    Apr 18, 2006
    Messages:
    1,114
    Likes Received:
    0
    Location:
    Dallas

    you are right if this was a product that targets the general population, however we are talking about a programming environment meant to be used by programmers, a very big and complex framework that is made to aid the life of programmers by providing CLR which is common for different languages, and finally a programming language that has been enhanced and which as all other OOP you could do little to nothing without knowing how it works or how to use it.

    Over all Visual Studio can be all this you said if you use it for an html editor or asp .net editor but that’s not what it is meant to be nor is what the person who started this thread is doing.
    My point was the described issue has nothing to do with the language and if you fail to understand why this is so, then you need to learn basics of programming and how your code is used by the framework or the very least be able to differentiate between OOP language, script, IDE, Framework.

    Visual Studio .NET is a tool for developing programs with different languages and for different systems or products
    C# is a language that is an enhanced version of legacy OOP
    .NET is the framework that makes everything possible to compile, run, control memory, interpid to machine language and much much more.
     
    Last edited: Sep 26, 2007

Share This Page