Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Adding form to a VB.NET solution

Posted on 2014-07-29
3
Medium Priority
?
660 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 1500 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 1500 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

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…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
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 keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

824 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