Skip to content

C#

C# discussions

This category can be followed from the open social web via the handle c-065f1d12@forum.codeproject.com

93.7k Topics 383.1k Posts
  • Accessing Word Documents in C#

    database csharp delphi question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Viewing Web Site Details

    csharp question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Why cant i declare this!

    help data-structures question
    3
    0 Votes
    3 Posts
    0 Views
    P
    You can only use 'const' on simple values that can be computed at compile time. For example, assigning a fixed value. Your code wants to do something more complex which involves creating a new object. Just because we can see it is fixed does not mean the compiler can. Therefore you need to use 'readonly' instead of 'const' to get the same effect. Phil Wright uk_phil_wright@hotmail.com
  • resource files in VS .NET

    question csharp visual-studio tutorial learning
    2
    0 Votes
    2 Posts
    0 Views
    J
    Senkwe Chanda wrote: Hi guys, simple question, how do you use resource files in C#? For example, suppose I create an icon using the editor in VS .NET and the file is named icon1.ico, how would I the go about referencing that file from my code? In VS.NET click on your icon in the Solution Explorer then in the properties box change the Build Action to "Embedded Resource". Now when you build your project you can get a stream to the file from the assembly. System.Reflection.Assembly asm = GetType().Assembly; System.IO.Stream = asm.GetManifestResourceStream("myDefaultNamespace.myFolder.Icon1.ico")); The string that is passed in is a tad difficult to understand at first. myDefaultNamespace is the namespace that is assigned by default to new classes that are added to your project. You can see what this is by going into the properties for your project. If you create a folder within your project and place icons in there, then you also append the folder names to the namespace (if you haven't noticed it -- when you create a folder, any classes created inside that folder have the folder name appended to the default namespace); finally append the filename. In the example above i have an icon named Icon1.ico located in a folder called myFolder in my project with a default namespace of myDefaultNamespace. It is possible to set the default namespace to nothing, in which case you use the folder (if any) and the filename. HTH, James Sonork ID: 100.11138 - Hasaki "My words but a whisper -- your deafness a SHOUT. I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
  • How to open a new window??

    help tutorial question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • questions about C#

    csharp c++ java com
    3
    0 Votes
    3 Posts
    0 Views
    A
    Thank you so much for your response, it will help a great deal. From everything that I have read experince in C++ will make learning C# the easiest. Doing this paper has helped me to get a direction of what areas I want to concentrate on in programming. Have a great day, Aaron T.
  • Package Application

    question workspace
    5
    0 Votes
    5 Posts
    0 Views
    G
    There we go, I knew there had to be a simple smart way :)... You have made my day.. Cheers
  • Lock a column in datagrid

    winforms question announcement
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • How to make custom/own BASE classes

    csharp dotnet tutorial
    4
    0 Votes
    4 Posts
    0 Views
    J
    Felix Nielsen wrote: But let's say I want to be able to add the "reference" from the GAC with VS. Even though I have added the DLL to GAC, the listbox don't have my DLL? It seems odd, but VS.NET doesn't show assemblies that are in the GAC. Instead it shows assemblies from a few pre-defined locations. The best place to put such an assembly would be $windows_dir\Microsoft.NET\Framework\$dotnet_version\ Then VS.NET will see your assembly and add it to the list. Now the question you need to ask yourself is "What about my assembly warrants making it available to everyone?" 9 times out of 10 there isn't really any reason to put something in the GAC. The GAC should be used for assemblies that other people/companies will want to use in their products where the size of the assembly is large enough to warrant not keeping a local version. Felix Nielsen wrote: If I copy my DLL to the webapp's BIN folder, and add the Reference it displays a full path(URL), and If I copy the webapplication to another URL - it would fail right? Nope, VS.NET references everything relative to the project directory. So if you place an assembly in your bin directory the project file stores it as "bin\myAssembly.dll". If it can't find it there, it will begin a search to find it in other locations too. I don't recall what those locations are off the top of my head though. HTH, James Sonork ID: 100.11138 - Hasaki "My words but a whisper -- your deafness a SHOUT. I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
  • How to import C# dll dynamically

    csharp help tutorial question
    6
    0 Votes
    6 Posts
    0 Views
    A
    Thanks guys. Great help ;)
  • Registry

    question windows-admin help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Playing sounds through c#

    learning csharp com game-dev algorithms
    10
    0 Votes
    10 Posts
    0 Views
    P
    Cool, thanks again. J Jason King jason.king@profox.co.uk Feel the love at www.profox.co.uk
  • Changing value of all TextBoxes

    csharp visual-studio help question
    5
    0 Votes
    5 Posts
    0 Views
    S
    James T. Johnson wrote: if( c is System.Windows.Forms.TextBox ) That's a better way. Probably more robust too (if MS changes the text of class names). Cheers, Simon X-5 452 rules.
  • Inherit 2 classes in c#

    tutorial csharp question
    2
    0 Votes
    2 Posts
    0 Views
    T
    If you're referring to multiple inheritence (mi), it is not supported in C#. However, in addition to inheriting from a single class you can also inherit from as many interfaces as you like. Cheers, Tom Archer Author, Inside C#
  • Compile error, help!

    help question
    4
    0 Votes
    4 Posts
    0 Views
    P
    Thanks, James, for the link to those two DotNet mailing lists. I'm already signed up! :-D -- Peter Stephens
  • Resource file (.resource/.resx) help/howto

    help csharp visual-studio com hardware
    3
    0 Votes
    3 Posts
    0 Views
    P
    BTW, the prefix to access the file is actually the default namespace for the project. If you blank out your default namespace, you will then access the icon by just "Icons". -- Peter Stephens
  • Types of exceptions

    question
    2
    0 Votes
    2 Posts
    0 Views
    J
    The documentation should tell you what exceptions to expect, but you can get the name by doing the following catch(Exception e) { string name = e.GetType().Name; Console.WriteLine("Exception: {0}", name); } Or just take the catch out altogether and the framework will catch it, in the description it should give the name of the exception. James Sonork ID: 100.11138 - Hasaki "My words but a whisper -- your deafness a SHOUT. I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
  • Easy question: bin & obj directories

    question csharp visual-studio
    2
    0 Votes
    2 Posts
    0 Views
    J
    I believe the bin directory contains the final output, while the obj directory contains any temporary files (compiled .resources), vs.net temp files, and the like. James Sonork ID: 100.11138 - Hasaki "My words but a whisper -- your deafness a SHOUT. I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
  • How to Map a C++ Struct from a DLL into C#

    csharp c++ tutorial
    8
    0 Votes
    8 Posts
    0 Views
    J
    No problem, I learned a bit myself :) James Sonork ID: 100.11138 - Hasaki "My words but a whisper -- your deafness a SHOUT. I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
  • DropDownList in C# Application

    database tutorial csharp data-structures question
    7
    0 Votes
    7 Posts
    0 Views
    J
    There is another way, it involves using the DataSource, DisplayMember and ValueMember properties of the combo box. If I weren't late for work I'd describe exactly how to use it, but if you search the docs for DisplayMember there is an example of using it :) James Sonork ID: 100.11138 - Hasaki "My words but a whisper -- your deafness a SHOUT. I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972