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
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...
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"
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.
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.
Re: I learned VB 6, now im having issues with .net
Quote:
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... :)
Re: I learned VB 6, now im having issues with .net
Quote:
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.