Current location: Hot Scripts Forums » Programming Languages » Windows .NET Programming » Userforms in VB.NET vs. VB6


Userforms in VB.NET vs. VB6

Reply
  #1 (permalink)  
Old 03-04-04, 11:15 PM
daveyisu daveyisu is offline
New Member
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Userforms in VB.NET vs. VB6

I'm new to VB.NET so I'm having a great deal of difficulty adapting. My VB experience isn't all that deep in general, but I have a good idea for the most part of how the code works. Recently I wrote some code to perform file conversions and also call C .dll files to perform some complex mathematics (Fourier transforms and the like).

I wrote the original code in VB6, but now I want to compile it into an .exe so I was going to use Visual studio .net.

I guess my first question is whether this is my best path for me to take? If there would be an easier way for me to compile my VB6 code into an .exe I'm up for it. If not I'm led into my second question.

I used a userform in VB6 to make the user inputs much clearer. The code also performs three separate functions, so I used options buttons etc. to make this all work. It was easy for me to figure out the syntax for utilizing the form. Part of my code was similar to:

dim inputfile as string
inputfile = userform1.TextBox1.value
Open (inputfile) For Input As #1

This code won't work in .NET as I'm sure you're all aware. Could someone please tell me how I would go about making it comparable?

*Note* The same sort of thing applies to optionbuttons. I realize they are radiobuttons in .NET, but code such as:

If (userform1.optionbutton1.value = true) then

won't compile in .NET.

I realize this post has gotten really long, but I would greatly appreciate any insight.

Thanks ahead of time

David
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-23-04, 08:07 PM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by daveyisu
I'm new to VB.NET so I'm having a great deal of difficulty adapting. My VB experience isn't all that deep in general, but I have a good idea for the most part of how the code works. Recently I wrote some code to perform file conversions and also call C .dll files to perform some complex mathematics (Fourier transforms and the like).

I wrote the original code in VB6, but now I want to compile it into an .exe so I was going to use Visual studio .net.

I guess my first question is whether this is my best path for me to take? If there would be an easier way for me to compile my VB6 code into an .exe I'm up for it. If not I'm led into my second question.

I used a userform in VB6 to make the user inputs much clearer. The code also performs three separate functions, so I used options buttons etc. to make this all work. It was easy for me to figure out the syntax for utilizing the form. Part of my code was similar to:

dim inputfile as string
inputfile = userform1.TextBox1.value
Open (inputfile) For Input As #1

This code won't work in .NET as I'm sure you're all aware. Could someone please tell me how I would go about making it comparable?

*Note* The same sort of thing applies to optionbuttons. I realize they are radiobuttons in .NET, but code such as:

If (userform1.optionbutton1.value = true) then

won't compile in .NET.

I realize this post has gotten really long, but I would greatly appreciate any insight.

Thanks ahead of time

David
In VB6, just go to the "File" menu and then click "Make EXE".

There are quite a few ways you can read text file data in VB.NET. http://www.freevbcode.com/ShowCode.asp?ID=4492 is one example.

For Radio Buttons in VB.NET, use

Code:
If optionbutton1.Checked Then
' Do whatever
End If
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-25-04, 03:30 PM
daveyisu daveyisu is offline
New Member
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks

Thanks for the help with the userform. I have that up and running great, but as you can see from my latest post, the ability to read the file correctly is still eluding me.

Thanks again

David
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-25-04, 04:35 PM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by daveyisu
Thanks for the help with the userform. I have that up and running great, but as you can see from my latest post, the ability to read the file correctly is still eluding me.

Thanks again

David
ok, here is the code I took from the link posted and broken down.

Code:
Dim strContents As String					 ' Store the contents of our file
Dim objReader As StreamReader		 ' Our streamreader is the file i/o handle.
 
objReader = New StreamReader("C:\MyTextFile.txt")	 ' Open text file
strContents = objReader.ReadToEnd()	 ' Read the entire file and place the contents in the strContents variable.
objReader.Close()	' Close file
Also, don't forget to import the System.IO namespace at the top like:

Code:
Imports System.IO
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VB.NET - Show another form? Tesco Windows .NET Programming 11 06-04-04 08:09 AM
need vb.net help darksoap Visual Basic 1 06-04-04 08:03 AM
load and unload forms in VB.Net warpminded Windows .NET Programming 3 03-16-04 12:07 PM
($50 for........)Need to get a small project in VB.NET done in 6 hours superprogrammer Job Offers & Assistance 3 01-29-04 01:13 AM
VB 6.0 vs. VB.NET Dj_Farout Windows .NET Programming 0 01-08-04 06:46 PM


All times are GMT -5. The time now is 09:24 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.