I'm trying to update an application from vb6 to vb.net. The orig app used the winsock control. Unfortunately I can't nor do I want to use it in the re-write. Are there any decent public classes with events that wrap the Socket class? I've found a few on google but all were buggy and I think it may be a little over my head to write my own from scratch.
Sockets are built in now: http://msdn.microsoft.com/en-us/library/system.net.sockets(VS.71).aspx
If you are doing web related tasks then you should look at System.Net.WebClient or System.Net.HttpWebRequest.
Related
I'd like to add a group in Windows Explorer's context menu that works like 7Zip's:
I know there's the shortcut of using eg. FastExplorer, but I'd like to avoid depending on a third-party tool (besides, FE happens to be deadware).
Google seems to say that this is done through a COM DLL that implements the IContextMenu interface, but the examples I found were all done in C# or VC++.
Before I investigate further, can VB.Net gurus tell me if this can be done in VB.Net, or only C#/VC++ will do?
Thank you.
Edit : Does someone know of a third-party solution so that this can be done without requiring an upgrade to .Net 4?
Yes: if it is doable in C#, then it is doable in VB.Net.
I'm having trouble with the SerialPort function intermittently crashing while data logging for several days. It's been a hard problem to debug and I would like to try Zach Saw's fix which he talks about here and provides code for in C#
My question is, to do this, do I need to rewrite the entire use of the Serial Port in my code?
If I use the System.IO.Ports.SerialPort module, is there a way to just do a DLLImport of SetCommState to set fAbortOnError to false, or do I need to abandon the SerialPort module entirely and write everything using the kernel32.dll?
I'm pretty sure in this case you could import his project into your solution, and it should run just fine. Since VB and C# are both CLR languages, they both compile down to the same intermediate language.
Check out this page
http://support.microsoft.com/kb/823179
It's got the proper declarations for SetCommState, with some example code. Zach's fix is to basically open the com port as a file first, call setcommstate, then use the serial io functions in .net. I haven't tried it but his post sounds like you shouldn't have to do much at all to your code.
Having tested about 15 different solutions to the various problems with serial ports in .NET, I settled on using CommStudio. It's been rock solid ever since.
You can get CommStudio Express (their free version) here: http://www.componentsource.com/products/commstudio/downloads.html?rv=42917
I've previously asked a question about designing a service that receives video files, sends them to an encoding service, waits for the encoding to be completed, and then downloads the files.
I started writing the code for that and one of my workmates suggested I use .Net 4.0 new features, instead of writing it using BackgroundWorker. I've done some reading and the Parallel feature sounds great. Are there any more new features I should implement? I'm new to .net 4.0.
Thanks!
Parallel Extensions is certainly one good option here. Another you might want to consider is Reactive Extensions, which implements a "push" model instead. It takes a little while to get your head round, but it's very elegant - and might work very well with your asynchronous model.
I am using C# and Visual Studio 2008.
I have a class that will turn on the scanner of my Windows Mobile Device and then will capture the read of the scanner when pressed. It will also shut down appropriately and cleanly. I am using a vendor provided SDK to do a lot of the heavy lifting.
I have this working correctly in a Mobile App, but I also need the dll to be able to be called via COM/ActiveX from a web site. I have been going around and around about how to do this. I've bounced between various settings and project types. I've tried converting it over to C++ and ATL. But so far nothing works.
I get conflicting information depending upon where I look. I need help. Can only C++ do this? Is there something I'm missing? I can't be the only person needing to do this. How can I do this?
You cannot create ActiveX/COM components in managed code with the Compact Framework. There is not EE Hosting support, so it simply cannot be done. You will have to write this in C++ (not managed C++, but old-fashioned native).
As a side note that is sometimes overlooked on COM controls, you also have to implement IObjectSafety for the control to work in a browser.
We are in the process of creating active-x controls used within our application.
Since Microsoft stopped supporting classic Visual Basic, is it wise to use Visual Basic to develop the Active X control or the latest VC++/ATL/MFC libraries provide more feature where we can create controls faster by leaving Visual Basic flexibility?
We will not be able to use .NET/VB.NET/C# since the application is supposed to work inside containers and containers may not support latest .NET runtime.
Any other language is best fit for Active X control development other than VB and VC++?
I, personally, would recommend using Delphi for this. It is still actively developed, and has the control you get with C++, but a rapid development environment more like VB.NET.
#nobugz: If you are really interested what is ActiveX in Delphi, look at docwiki. Normally it is 100% source code (yours + VCL, VCL is also available as sources) with autogenerated COM wrappers. So all potential security problems are also in source code. If you find a security problem in VCL, please send a bug report to Quality Central.
Here is a good example on how to create ActiveX Controls with C# .NET
http://www.codeproject.com/KB/cs/CreateActiveXDotNet.aspx
By all means VB6 is the best language. After reading your question I feel that you are a VB6 developer. If you know VB6 and use it then why hesitate using it for producing ActiveX controls.
I program in Delphi as well as VB6 along with VB.NET and C# but creating ActiveX controls is the easiest in VB6 compares to all other development tools.
If you are hell bent on not using VB and if you are looking for an alternative then try out PowerBasic (commercial - very costly) or PureBasic (commercial but affordable) Get it from here or better still MinGW (a GNU C++ compiler).
I have to say that VB6 with a good book like Developing COM/ActiveX Components with VB6: A Guide to the Perplexed you will be up and running faster.