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
L

LobsterDK

@LobsterDK
About
Posts
4
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Try {//code} catch{throw;} ?
    L LobsterDK

    You would do this if you needed to perform some form of cleanup that is only required if an error occures but don't want to swallow the exception at that point in the code. Catching and then immediately re-throwing without doing anything else serves no purpose though.

    C# csharp com tools tutorial question

  • C# and old "C" Dlls
    L LobsterDK

    Yes, as with the requirement of defining the function signature in C# you also have to supply a description of the structure as well. For the structure you provided the sig would be [StructLayout(LayoutKind.Sequential)] struct SerialInfoMD { [MarshalAs(UnmanagedType.ByValArray, SizeConst=8)] public byte[] ID; public byte Something; public int New; // note the capitalization change. Syntax error otherwise. } Things can get tricky when marshalling data between managed and unmanaged code. For example, in your function signature you have the return type as ulong. Is the return type for the C function an unsigned long? Unsigned long is 32-bits on Win32 but is 64-bits on .NET so the appropriate return type in the C# method is uint if the return type on the C function is unsigned long. It gets even more murky when dealing with arrays. You might wanna check out information on data marshalling on MSDN. Try this URL for a start. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconInteropMarshaling.asp

    C# csharp data-structures help question learning

  • A silly listview question
    L LobsterDK

    What you are trying to do is not directly possible with the listview provided with .NET. The items collection is a collection of data associated with each element in the list, not a collection of controls to be displayed within the list. By default, if no string is supplied when adding items to the collection the objects ToString method is used to get the string to display. This is why you are getting the output you are getting. There are articles here on Code Project that show listview implementations that are capable of docking other controls within the listview. Note that it's not something you will be able to do with a trivial amount of code (though not an unobtainable goal either).

    C# database data-structures question

  • using a switch for a range of numbers
    L LobsterDK

    This is one of those features that VB has that I wish C# supported. You can just add case statements for each of the values adding the break statement to the last case in the range switch (value) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: DoSomething (); break; } not pretty but it works.

    C#
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups