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
G

Gonzalo Cao

@Gonzalo Cao
About
Posts
28
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • C# MySQL Question
    G Gonzalo Cao

    Actually this is not your fault, MySQL reader transforms TINYINT to BOOL by default. In order to prevent this, you need to add the following line to you connection string: "Treat Tiny As Boolean = false". Just by doing this, TINYINT will be treated as a numeric value :)

    C# help question csharp mysql

  • custom control problem in design time
    G Gonzalo Cao

    The response you've got before is going to work, anyhow I think that you need to know why this won't work. Thing is that DefaultValue, prevents the form's designer from generating code for this property. So when you set the property as true, no value is generated and bool variables always initialize to false. That's what's giving you trouble.

    C# help design

  • Problem wih UDP connections
    G Gonzalo Cao

    Hi all, I've got an strange problem with UDP communication which I can't explain. First of all let's explain the situation: We have some access control terminals that store the movements of the staff, this devices are connected via ethernet and send this movements through port 4370, using UDP. To link with these devices we have an application that can be installed as a service which periodically downloads the data from them and inserts the data into the database, besides that we have an application for the end user that links to the database and in case of need is able to link with the devices as well. At first we installed both applications in a Windows XP machine and it worked perfectly fine, but after sometime we decided to move the first application to a server and this is when trouble showed up; for some reason it seems the application is unable to connect with any of the devices, but all of them are reachable via ping, telnet and web. And to make things worse I installed the end user application in this server and it connects without any problem. I don't know if this is the right place to post these, but if anyone can give me some tip I'd be most grateful. Best regards.

    System Admin database sysadmin help

  • ToolStripMenuItem.Visible always returns false?
    G Gonzalo Cao

    I don't think this is the problem, but just in case: If you check the value on step by step debug the value will always be false, since the window is hidden by visual studio.

    C# question

  • How to convert any object to byte[] without marking it Serializable or DataContract?
    G Gonzalo Cao

    Were you able to fix it?? With the sample code you've posted I was not able to find the problem.

    C# tutorial question learning

  • How to convert any object to byte[] without marking it Serializable or DataContract?
    G Gonzalo Cao

    You welcome. Good luck with you project.

    C# tutorial question learning

  • How to convert any object to byte[] without marking it Serializable or DataContract?
    G Gonzalo Cao

    public static object RawDeserialize(byte[] rawdatas, Type anytype)
    {
    int rawsize = Marshal.SizeOf(anytype);

       if (rawsize != rawdatas.Length)
       { return null; }
    
       IntPtr buffer = Marshal.AllocHGlobal(rawsize);
    
       Marshal.Copy(rawdatas, 0, buffer, rawsize);
    
       object retobj = Marshal.PtrToStructure(buffer, anytype);
    
       Marshal.FreeHGlobal(buffer);
       return retobj;
     }
    

    Here it is :)

    C# tutorial question learning

  • character postion replacemenet
    G Gonzalo Cao

    public void RelocateChar(ref string text, int pos1, int pos2)
    {
    char[] supportArray = text.ToCharArray();
    char supportChar;

    supportChar = supportArray[pos2];
    supportArray[pos2] = supportArray[pos1];
    supportArray[pos1] = supportChar;
    text = new string(supportArray);
    }

    Maybe there are better solutions, but this one should work.

    C#

  • How to convert any object to byte[] without marking it Serializable or DataContract?
    G Gonzalo Cao

    Hi, I do this and it works for me. public byte[] RawSerialize(object item, Type anyType) { int structSize = Marshal.SizeOf(item); IntPtr ptr = Marshal.AllocHGlobal(structSize); Marshal.StructureToPtr(item, ptr, true); byte[] bff = new byte[structSize]; Marshal.Copy(ptr, bff, 0, structSize); Marshal.FreeHGlobal(ptr); return bff; }

    C# tutorial question learning

  • Call a function from a dynamically loaded C dll [Answered]
    G Gonzalo Cao

    Thank you :)

    C# csharp c++ question

  • Call a function from a dynamically loaded C dll [Answered]
    G Gonzalo Cao

    Ok, now, that's an answer :). And now here's a question, what if SomeMethod's signatures does not match the delegate signature?? Do I get an ArgumentException?? I know this should be a problem since he knows the signature of the method. Just asking out of curiosity.

    C# csharp c++ question

  • Call a function from a dynamically loaded C dll [Answered]
    G Gonzalo Cao

    I don't know if you have better ways to do this, but one idea is to declare them all and after that you define a Delegate with the same signature. This way you can assign the corresponding function to the delegate, this way you got pretty much the same functionality that you get with pointers to functions.

    C# csharp c++ question

  • How to add multiple components (texboxes,compoboxbutton etc...) to a listview
    G Gonzalo Cao

    If you working with windows forms you can check the XPTable article here in codeproject. It can fit you requirements. If not you can create your own Listview, since default one is not editable.

    C# sales help tutorial

  • To use or not to use worker thread in Windows Service?
    G Gonzalo Cao

    Touche!! And that's why my mamma told me I need to read the question before giving an answer :$

    C# csharp c++ com question

  • To use or not to use worker thread in Windows Service?
    G Gonzalo Cao

    I mostly use threads, and if you want to keep the periodicity logic apart from the rest of the logic you can use something similar to this: while(true) { DoStuff(); sleep(1000); } The good thing about this, is that you running this code through a separate thread; thus it does not interfere with the UI thread. On large processes this will save you a lot of problems with the application not responding or working slower than expected. Anyway as someone else told you both solutions could work, I'd use timer for trivial tasks and the thread worker for more complex stuff, but that's just my choice.

    C# csharp c++ com question

  • Remote desktop server/client
    G Gonzalo Cao

    hi, It's not that I'm try to be mean, but you shouldn't ask such wide questions. Get some information, start your project and if you stuck in some point maybe someone can help you.

    C# sysadmin question

  • Display messages, when using windows services
    G Gonzalo Cao

    Another good idea is to have an application that works as a monitor and gets the feedback from the service, since you can use sockets and you can use Window's message queue. Or you can use a smpt client to send e-mails reporting service problems.

    C# help

  • How to use HashSet
    G Gonzalo Cao

    try this: HashSet stringSet = new HashSet { "abc", "aa" } ;

    C# csharp help tutorial

  • OnShown event not always triggered
    G Gonzalo Cao

    On some forms the OnShown event won't be raised and I was not able to figure out why, this is most strange because it works fine on most cases and I use a class that inherits the Form class and handles the event for me, so there should be no way for me to mess up with the event handling. Did anybody experience this problem?? Were you able to fix it?? I'd be most thankful if anyone could offer a piece of advise so I can solve this.

    C# help question

  • can I make zooming in the form itself ?
    G Gonzalo Cao

    I guess this is quite obvious, but besides making sure that you only redraw the desired area and not the whole control, make sure that you are not reading from the serial port un the UI thread. Long processes can interfere with the drawing of the form.

    C# question help
  • Login

  • Don't have an account? Register

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