Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
| Tutorial: How do I do it in VB.NET?
This tutorial explain some of the more common migrating problems from VB to
Load a picture
Picture1.Picture = LoadPicture(path)
Dim img As Image = Image.FromFile(path)
Picture1.Image = img
Load a icon
Me.Icon = LoadPicture(path)
Dim ico As New Icon(path)
Me.Icon = ico
Read from a file
Open path For Input As #1
Line Input #1, buffer
Dim fs As FileStream = File.Open(path, FileMode.OpenOrCreate,
Dim sr As New StreamReader(fs)
Buffer = sr.ReadLine
Write to a file
Open path For Output As
Write #1, buffer
Dim fs As FileStream = File.Open(path, FileMode.OpenOrCreate, _
Dim sr As New StreamWriter(fs)
Check for an error
On Error Goto errhandler
Throw New Exception("error description goes here")
Catch e as Exception
In VB7, there is a new keyword called AddHandler. AddHandler makes handling
events a snap.
AddHandler object.event, AddressOf
Other 5 submission(s) by this author
|Report Bad Submission|
See Voting Log |
|Other User Comments|
|4/15/2002 12:17:53 AM:roswellevent|
5 from me :)
|4/15/2002 5:49:41 AM:Dave Lambert|
Excellent stuff, but why .NET has to be
so obscure is beyond me. I can see us
all writing wrapper classes for the
next n months to simplify the syntax
back to something memorable and to what
it should have been in the first
|4/29/2002 11:13:58 AM:Sam Moses|
I'm still not clear
on the difference in syntax though. It
seems to me that this .NET code could
be just as simple as the vb6 code
without much real change in the mothod.
|5/1/2002 9:39:04 PM:Slider|
To understand why, you must look at the
bigger picture - platform & OS
indepentancy. This will mean that in
the fututre, your application won't be
tied just to 32-bit Intel platform &
Windows OS. I've written a wrapper
class to handle all VB7 'oddities' and
am adding functions to them. Sean,
great tutorial for those who need it!
Keep them coming...
|5/16/2002 1:51:28 PM:Pheonix|
In VB6 I can do the following:
picVideo.width = frmMain.width
would I do that in VB.Net?
|7/8/2002 2:01:42 AM:trance|
the syntax seems very similar to java,
except for the ';'s
|7/12/2002 2:46:48 PM:JohnB|
In looking at this, it seems to me that
VB.NET actually will take more time to
code than VB6. Point in case: App.Path
& App.EXEName VS.
ssembly.Location.ToString Looks to me
like MS wants you to get carpel tunnel
syndrome... ;) Thanks for the info
|8/28/2002 12:11:47 PM:Dhaval Faria|
hey.. that was gr8.. but I need some
diffrent help.. can u help me? please..
I need help badly.. but its easy.. but
I am not getting it.. 5 globes from me..
|9/23/2002 2:22:18 AM:|
great job....keep it coming along..
|1/18/2003 4:20:30 PM:VBGOD|
|1/31/2003 2:26:45 AM:|
|5/6/2003 5:16:39 AM:|
Why it seems that VB.net is more
difficult to code? I mean it takes
longer code than the old VB.
|5/29/2003 9:48:31 PM:|
I just got my hands on .NET, I need to
catch up... Excellent head start for
|7/4/2003 4:24:40 AM:Deepak Kumar Shaw|
It's really talking...
compect and to
5 from me, good work!
|7/13/2003 3:15:21 PM:|
im new to vb.net
how about Time()
and Date() functions?
i want to create
a clock like the one displayed in the
|11/6/2003 5:30:05 PM:|
how about app.version ???
| Add Your Feedback! |
|Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name. |
NOTICE: The author of this article has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular article, please click here.