|
-
November 2nd, 2008, 10:52 PM
#1
I learned VB 6, now im having issues with .net
I took VB 2 years ago in school, and of course the year after i take it they upgrade to .net.. Anyways, I was wondering why this code works vs the other.
loginText.Left = 12
loginText.Top = 47
loginText.Width = 33
loginText.Height = 13
that works, and that's how i learned to do it. But i was messing around in the .net one and i was wondering why something like this wouldnt work
loginText.Location.X = 12
loginText.Location.Y = 47
loginText.Size.Width = 33
loginText.Size.Height = 13
-
November 2nd, 2008, 11:12 PM
#2
Re: I learned VB 6, now im having issues with .net
1) You had a problem with school then two years ago. VB6 was officially declared dead in 2004. It should not have been taught in ANY school after 2003 [5 years ago]
2) Value Types (Like Point) can not be modified in that way. When you call
Code:
Item.Location.X = 10
The first part (Item.Location) returns a COPY of the Point instance, which is what you would be attempting to modify. It would NOT effect the original instance inside of Item.
There is a world of difference between VB.NET and previous versions. You must "unlearn" the majority of what you previously learned.
Consider the difference in spoken (slang) language between Los Angles, CA and London, Eng. The two are both English, but one does NOT translate to the other...
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
November 2nd, 2008, 11:17 PM
#3
Re: I learned VB 6, now im having issues with .net
Alright, could you explain what this means?
Warning 1 Variable 'loginText' is used before it has been assigned a value. A null reference exception could result at runtime.
What im trying to do is create object, when the user clicks certain things. This is an example.
Dim loginText As Label
loginText.Left = 12
loginText.Top = 47
loginText.Width = 33
loginText.Height = 13
loginText.Text = "Login"
-
November 3rd, 2008, 12:30 AM
#4
Re: I learned VB 6, now im having issues with .net
It's warning you that you didn't initialize it. There you go!
Code:
Dim loginText As Label = new label
loginText.Left = 12
loginText.Top = 47
loginText.Width = 33
loginText.Height = 13
loginText.Text = "Login"
Still have to show it, and make it visible.
-
November 3rd, 2008, 01:10 AM
#5
Re: I learned VB 6, now im having issues with .net
Thanks, that helped me quite a bit, specially in stuff i hadn't coded yet. But I'm in another situation. This is the menu strip button property.
Private Sub LoginToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginToolStripMenuItem.Click
I also added loginText.visible = true
but it doesnt show up when i click.
-
November 6th, 2008, 05:56 PM
#6
Re: I learned VB 6, now im having issues with .net
 Originally Posted by TheCPUWizard
1) You had a problem with school then two years ago. VB6 was officially declared dead in 2004. It should not have been taught in ANY school after 2003 [5 years ago]
There are still opportunities left for VB6.0 knowledge like for maintaining applications made with it and as a hobby, you can still do so much with it...
-
November 7th, 2008, 04:54 AM
#7
Re: I learned VB 6, now im having issues with .net
 Originally Posted by dee-u
There are still opportunities left for VB6.0 knowledge like for maintaining applications made with it and as a hobby, you can still do so much with it... 
However as rule of thumb..
* DO NOT start a new project in VB6, Rather Use .NET..
* IF the VB6 requires major work, Do a complete rewrite in .NET ..
* In .NET, it is easier to get most funtionality out of Vista & XP with minimum Code. VB6 requires tons of API's..
* MS is dropping VB6 backwards compatibility in the OS, (cant remember the article) , Soon the VB6 Proggy will need a .NET upgrade.
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|