Resources for excel in Visual studio - visual-studio

I have been tasked to rewrite an old excel workbook that is full of ugly vb macros. It is mostly some simple data entry, and some reporting functionality on top of that. I am not super experienced with Excel, but I can get around.
I know that visual studio has project types for excel, but I am not really sure what is possible. I am a c# developer, and would greatly prefer that to crappy vb macros.
Are there any resources for learning to write plugins and workbooks in c#? Google does not seem to be helping me very much. I really just need a few good examples and I should be good to go?
I generally can't find many good resources for excel in general either? Most are old or unhelpful. Any recommendations?

I do a lot of spreadsheet manipulation in c# via the COM interface. You can find examples and more information from MS here.
If your spreadsheets are simple, you can also use ADO.Net interfaces (described here) but I never could figure out how this would work for non-simple worksheets.

Here is a Microsoft knowledge base article on using interop to automate Excel.

I just stumbled across Excel-Dna yesterday, and it looks like a very promising way to use VB.NET/C# in a UDF/macro capacity within Excel. I haven't had a chance to try it yet, but it seems to be actively maintained and has an active mailing list.

Related

XSLT or BizTalk-Mapping generated from Excel

Does anybody know if there is a tool which can convert an Excel document (or something similiar, it really does not have to be Excel) to an XSLT document or to a BizTalk Mapping (actually here it also must not be a BizTalk specific document).
If there is no tool for this, does anybody know references about this theme? I know this is a really common question, but unfortunatelly I can not be more specific. I need this for research and preparing to develop a software.
Or at least maybe someone has any keywords which might help me to research, because actually I really don't know how this problem can be described.
No, what you are asking for does not exist.
In practice, the crosswalk is maintained by a Business user using a tool appropriate for them, almost always Excel.
The developer then takes this and implements a BizTalk Map based on the information provided by the Business. It is never a direct translation so realistically, a tool is simply not possible.
What you can use at ship time is the BizTalk Map Documenter: http://biztalkmapdoc.codeplex.com/

Bluetooth application in Visual Studio 2010 Ultimate using C#

I have seen many links that talk about 32feet.NET library. I need to know how to use this in C#. Pretty much everything uses Visual Basic but I am not too familiar with that language. I do prefer to do it C#. As additional information, the application will be sending data similar to a serial interface. This means that it will be sending bytes to a device that will respond with bytes as well. I am trying to use the built-in bluetooth but I cannot find the port associated with that nor am I able to detect it using other examples online, I have tried the Power Shell example as well.
The thinking was when I wrote the documentation was that there were a lot of VB users using the library, and that all C# users would be able to read the VB code, even if they weren't able to write VB themselves. See http://32feet.codeplex.com/wikipage?title=Visual%20Basic%20Samples for some help.
Have a go at looking at the examples and see if you can pick out the real code in there -- I myself find it hard to ignore the If, Then, End etc words but can manage it. I've just updated the main pages to include C# versions of the samples, when I have some more free time I'll do some more. :-)

Free online class & module repositories for Visual Basic 6 (VB6)

Are there any free online repositories (or collections) of handy classes and modules for Visual Basic 6?
(I am particularly interested in Canvas or MemoryBitmap-like class that wraps the MemoryDC functionality).
Update. Below is what I found:
VB Helper - Tips, tricks, & example programs for Visual Basic developers
I used the following:
Karl Petersen's Classic VB
Randy Birch's vbnet
vbRad.com
vb6.us
And others mentioned vb Accelerator, which is awesome.
The VBForums.com Code Bank is probably on par with Planet Source Code these days in terms of activity, though PSC has a much more extensive library.
Well, VB6 is a out-of-fashion language, we are more talking about archives than repositories.
I remember planet source code, I just made a quick look here and they updated their site since my last visit, but it look like they keep their library.
There was also the code project but it look like the VB6 code has been pushed aside. The navigation put emphasis on VB.Net but you could access the VB6 code and article through their search engine.
Update:
I forgot VB Accelerator, it look inactive since a while, but at least, they keep it on-line.
I found Randy Birch's vbnet a useful resource, especially when having to dip into the Win32 API.

Do you use Data-aware classes?

I'm using VB6.
Data-aware classes refers to classes whose DataBindingBehavior or DataSourceBehavior property is set.
I learned this concept from MSDN and am wondering usually when should we use this technique of Data-aware classes? Or just like the Data Environment Designer which is just ignored by most developers?
The ability to create data-aware classes is just another aspect of Visual Basic's extensibility model. Along with the ability to create standard Classes and UserControls, you can create them as data-aware classes that can plug into VB's data binding mechanism.
You can wrap something like an ADO Recordset or ADO Data Control to create a more application-specific component, or you can create your own from scratch to provide data binding for some sort of out of the ordinary data. You can even create basic custom OLE DB Providers for unusual requirements by writing VB6 data aware classes in conjunction with the OLE DB Simple Provider (OSP) Toolkit.
Most of these things are rarely used today, because VB6 education is sorely lacking. A lot of programmers who learned by example shy away from data binding because they've found it frustrating. Most of this is a lack of understanding though. Instead we fall back on writing a lot of QBasic-like procedural code that sacrifices the power of VB6 event based programming.
You'll see the same thing in a lot of VB.Net and C# code loose in the wild. People seem unaware that event driven programming is actually much more important than the degree of "OOPiness" yet that's where the focus seems to be.
Programmers who understand the importance of this tend to have a lot fewer DoEvents loops in their VB6 programs and almost no gratuitous multithreading in their .Net programs.
I am as guilty as anyone of avoiding the Data Environment Designer and bound controls. I plan to become more aware of their use and capabilities though as well as making more use of VB6's Data Report Designer. These are powerful tools for writing data-centric programs, something I'm doing a lot more of lately.
There is no argument that Microsoft has dropped all support for VB6 development. But this doesn't say anything about the demand for it, which continues to be strong. If people have little to contribute to answering a question about VB6 they might spend their effort better elsewhere instead of shouting it down here. It is very sad that we never got a follow-on product - a newer VB supporting 64-bit development would be really nice. It just isn't in the cards.
Do you have any idea how old VB6 is? It's about ten years old. You should pretty well ignore anything you "learn" from VB6.
Some resources on VB6:
Support Statement for Visual Basic 6.0 on Windows Vista, Windows Server 2008 and Windows 7
Visual Basic 6.0 Resource Center (I didn't think such a thing existed)
Visual Basic History (I was right. October 1998)
Migration - Upgrading from Visual Basic 6.0
Product Family Life-Cycle Guidelines for Visual Basic 6.0 (it is unsupported as of March 2008):
Support will no longer be offered for Visual Basic 6.0 after nine years of general product availability.
Visual Basic 6.0 will no longer be supported starting March 2008.
All of this is from the following search: http://social.msdn.microsoft.com/Search/en-US/?Refinement=22&Query=vb6.
I think that feature has been ignored by most VB6 developers. Certainly I experimented with it once and never used it again. If you Google DataBindingBehavior or DataSourceBehavior there are relatively few hits.
I think what John is trying to communicate in his answer is that VB6 is not a good choice for new development unless you have strong reasons to the contrary - for example if your organisation already has a lot of VB6 experience and a lot of VB6 code to maintain, and no experience of other desktop programming languages. That sounds unlikely in your case, otherwise you'd be asking your colleagues the question rather than posting on Stack Overflow!

editing/viewing a Microsoft Outlook NK2 name cache file

I am trying to find some code which shows how one might open an Outlook NK2 names cache file. I did some searching and I have seen several people say that it's not possible, but then I find links to some freeware that can do just this so I know its possible. I would use the freeware applications, but would rather do it in my own code, and it easier to get an approval from management if I use my own code within my organization rather then a freeware/shareware application. I'm trying to write the code in VB, but I would like to find a example in any language if it helps.
Redemption has some Nk2 examples, although you may have to pay for a commercial license.
There is also a project on Google Code that has a lot of good stuff in it to get you started.

Resources