Solved

Adding form to a VB.NET solution

Posted on 2014-07-29
3
636 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

685 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