Solved

Conversion to DOT NET of Microsft.VisualBasic.PowerPacks.LineShape and Microsoft.VisualBasic.PowerPacks.ShapeContainer

Posted on 2009-04-14
6
3,712 Views
Last Modified: 2013-11-08
hello,
I have migarted a VB6.0 Project to VB.Net. There was a code as Microsoft.VisualBasic.PowerPacks.LineShape and Microsoft.VisualBasic.PowerPacks.ShapeContaine. The type no more exists in DOT NET environment. Can anyone please tell me the equivalent to be used in DOT NET or how to proceed to achieve the same.
Thanks
Public WithEvents linSize As Microsoft.VisualBasic.PowerPacks.LineShape
Public WithEvents ShapeContainer1 As Microsoft.VisualBasic.PowerPacks.ShapeContainer

Open in new window

0
Comment
Question by:MPakeezah
  • 4
  • 2
6 Comments
 
LVL 39

Expert Comment

by:abel
ID: 24136521
You can still use them. Include a reference to Microsoft.VisualBasic.PowerPacks.Vs (rightclick project, click Add Reference, search on the .NET tab for the right name) and then add an Imports statement on the top of your class:

Imports Microsoft.VisualBasic.PowerPacks

after that you can port your code the same way you ported the other code. Recent reference for .NET 3.5 about ShapeContainer: http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.powerpacks.shapecontainer.aspx

-- Abel --
0
 

Author Comment

by:MPakeezah
ID: 24136542
I forgot to mention that all references to Visual Basic Needs to be removed. The  code will be future migrated to C#.Net.
Please provide me with another solution.
Thanks.
0
 
LVL 39

Expert Comment

by:abel
ID: 24136585
This is not a reference to VisualBasic. It is a reference to a .NET library that is part of the .NET framework (and will stay part of it in the distant future, just like System or Windows.Forms).

It is always available and Microsoft suggests you use it. The name of "VisualBasic" in the library is to make migration easier, but it has nothing to do with VB6 (which uses COM object and not managed .NET objects).

Why reinvent the wheel if it has already been reinvented (i.e., ported) for you?
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 39

Expert Comment

by:abel
ID: 24136600
PS: you do not even need to add extra libraries to your final package, it is part of the Common Language Runtime. This is the note of MS about it:
The Microsoft.VisualBasic.PowerPacks namespace contains classes for the Visual Basic Power Packs controls. Visual Basic Power Packs controls are additional Windows Forms controls. They were originally released as free add-ins and are now included in Visual Studio.
0
 

Author Comment

by:MPakeezah
ID: 24136648
Thanks, will get back after confirming if this Dot NET Reference can be kept.
Regards.
0
 
LVL 39

Accepted Solution

by:
abel earned 500 total points
ID: 24136682
ok.

Note that where I said "Imports", you should use "using", like so, which is the way to make programming with namespaces easier:

using Microsoft.VisualBasic.PowerPacks;

(and send a message to MS to complain about the ill-naming of the package containing the name VisualBasic, assuming it cannot be used by other languages, which is ridiculous, you can just use it)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question