Solved

Adding form to a VB.NET solution

Posted on 2014-07-29
3
631 Views
Last Modified: 2014-07-30
I am converting/rewriting a VB6 application into VB.NET.
I have re-written three (3) forms and independently they work the way I want them to.
I now want to make them into one (1) solution.
I added the first form (frmMain) and it works.
I added the second form (frmCustomerEdit) and it works
I went to add the third form (frmBOMSetup) and get an error.
The third file (frmBOMSetup) is using the VB6 DirListBox, DriveListBox and FileListBox
(I am including the three (3) files in the same subdirectory, .Designer.vb, .resx, .vb at the other two (2) forms)
When I just import, no errors, when go to open it, I get the following error.

The designer cannot process the code at line 47: Me.DriveListBox1 = New Microsoft.VisualBasic.Compatibility.VB6.DriveListBox() The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again

In the .Designer.vb, If I rem out line 47 then it moves to line 46, etc
Line 48 is the start of the DriveListBox, DirListBox, FileList Initial componrt

Any idea how to bring this into the project without re-writing it again?

thanks,
0
Comment
Question by:Adam_930
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 40227382
Rewriting is the way to go if you do not want to spend the next year solving problems such as that one. Except for very simple applications, it often ends up taking less time rewriting the application than converting and trying to make it work. It also gives you results that will be easier to maintain in the long run.

Some of the controls in VB6 do not work well in .NET. Try to learn to use the .NET controls instead. Not only will you get less problems, but they usually give you a lot more information and are more interesting for the user because they offer more functionality. And let's say it, applications that use the old VB6 controls look like Windows 3.1 applications.

The FolderBowser is a lot more interesting than the DriveListBox.

And the FileOpenDialog or FileSaveDialog are a very good replacement for the combination of the 3 controls that you were using in VB6. You will find them in the Dialog tab of the Toolbox.
0
 

Author Comment

by:Adam_930
ID: 40227510
James,
I am actually looking to have the user point to location of a file the application Open/Closes
 am storing the folder location and my application opens/edits/saves the file
How do I just point to a file name?
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 500 total points
ID: 40227819
You fill a ComboBox with the filenames:

            For Each file As IO.FileInfo In New IO.DirectoryInfo("YourLocationDirectory").GetFiles()
                  ComboBox1.Items.Add(file.Name)
            Next

If you want, you can even add a search pattern so that only the files you created are listed:

            For Each file As IO.FileInfo In New IO.DirectoryInfo("YourLocationDirectory").GetFiles("*.txt")
                  ComboBox1.Items.Add(file.Name)
            Next
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

770 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