...

View Full Version : Need Help with a Vb .net problem



Bry Man
12-20-2004, 05:35 AM
Hey,

Im having problems diming a variable in vb .net, I know how to do it in Vb but .net its giving me and error saying that 'statment is not valid in a namespace' with this code 'Dim I As String'. Whats goin on with that, its works in vb but not .net?

oracleguy
12-20-2004, 05:55 AM
Can you maybe post some code?

Bry Man
12-20-2004, 06:10 AM
Well that was it...I was just toying around with a password box in my free time, the code works in Vb but not .net. I guess Ill post my Vb code..


Dim PassWord As String

Private Sub cmdEnter_Click()
If txtPassword.Text = PassWord Then
MsgBox ("Correct")
Else
MsgBox ("Wrong")
End If

End Sub

Private Sub Form_Load()
PassWord = "woot"
End Sub


This same code doesnt work in .net and its giving me the 'statment is not valid in a namespace' error when I dim Password as string and was wondering why

allida77
12-20-2004, 06:12 AM
Sounds like you are not doing the declaration within the Class.



Valid:

Public Class Foo
Dim i as String
End Class

InValid:
Dim i as String
Public Class Foo
End Class

Bry Man
12-20-2004, 06:16 AM
You Dim variables in general declarations am I not right, thats the way it was in Vb.

Brandoe85
12-20-2004, 06:45 AM
You Dim variables in general declarations am I not right, thats the way it was in Vb.
You can declare variables almost anywhere. Write your program in vb6, then open it in .NET and it will convert it over for you. I run your same code in .NET and it works fine. Surely it's something simple.

Bry Man
12-20-2004, 06:53 AM
Ha, didnt know you could do that lol, I picked up the beta 1 version of .net 2005 a while back and am jsut now opening it up, rather nice GUI I think

Brandoe85
12-20-2004, 06:59 AM
Really, I'm behind, I'm still using .NET 2003 professional :eek:, though, I still prefer to make my programs in vb6, I know, shoot me :p

Bry Man
12-20-2004, 07:03 AM
Hey if it was free I figured why not take advantage of it lol, free things from microsoft come once in a blue moon esp. when its one of their key money making products apart from their Os. We learn on Vb6 at school though, I need somebooks or sites so I can teach myself more at home because for our final this semseter We gotta come up with our own program and make it and ive got almost no clue what im going to do.

Brandoe85
12-20-2004, 07:06 AM
Ah, yes, I had to do the same thing, I swear thinking of what to do is harder than actually writing the program lol :p



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum