Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-20-2004, 04:35 AM   PM User | #1
Bry Man
Regular Coder

 
Join Date: Sep 2002
Location: California
Posts: 511
Thanks: 1
Thanked 1 Time in 1 Post
Bry Man is an unknown quantity at this point
Need Help with a Vb .net problem

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?
__________________
When traveling down the road of life, Try not to drag your face in the gravel.
Bry Man is offline   Reply With Quote
Old 12-20-2004, 04:55 AM   PM User | #2
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
Can you maybe post some code?
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Old 12-20-2004, 05:10 AM   PM User | #3
Bry Man
Regular Coder

 
Join Date: Sep 2002
Location: California
Posts: 511
Thanks: 1
Thanked 1 Time in 1 Post
Bry Man is an unknown quantity at this point
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..

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
__________________
When traveling down the road of life, Try not to drag your face in the gravel.
Bry Man is offline   Reply With Quote
Old 12-20-2004, 05:12 AM   PM User | #4
allida77
Regular Coder

 
Join Date: Jun 2002
Location: Cincinnati, OH
Posts: 545
Thanks: 0
Thanked 0 Times in 0 Posts
allida77 is an unknown quantity at this point
Sounds like you are not doing the declaration within the Class.

Code:
Valid:

Public Class Foo
Dim i as String
End Class

InValid:
Dim i as String
Public Class Foo
End Class
__________________
does this sig match?
allida77 is offline   Reply With Quote
Old 12-20-2004, 05:16 AM   PM User | #5
Bry Man
Regular Coder

 
Join Date: Sep 2002
Location: California
Posts: 511
Thanks: 1
Thanked 1 Time in 1 Post
Bry Man is an unknown quantity at this point
You Dim variables in general declarations am I not right, thats the way it was in Vb.
__________________
When traveling down the road of life, Try not to drag your face in the gravel.
Bry Man is offline   Reply With Quote
Old 12-20-2004, 05:45 AM   PM User | #6
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
Quote:
Originally Posted by Bry Man
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.
__________________
-Brando
Why using tables for eating is stupid!
Brandoe85 is offline   Reply With Quote
Old 12-20-2004, 05:53 AM   PM User | #7
Bry Man
Regular Coder

 
Join Date: Sep 2002
Location: California
Posts: 511
Thanks: 1
Thanked 1 Time in 1 Post
Bry Man is an unknown quantity at this point
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
__________________
When traveling down the road of life, Try not to drag your face in the gravel.
Bry Man is offline   Reply With Quote
Old 12-20-2004, 05:59 AM   PM User | #8
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
Really, I'm behind, I'm still using .NET 2003 professional , though, I still prefer to make my programs in vb6, I know, shoot me
__________________
-Brando
Why using tables for eating is stupid!
Brandoe85 is offline   Reply With Quote
Old 12-20-2004, 06:03 AM   PM User | #9
Bry Man
Regular Coder

 
Join Date: Sep 2002
Location: California
Posts: 511
Thanks: 1
Thanked 1 Time in 1 Post
Bry Man is an unknown quantity at this point
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.
__________________
When traveling down the road of life, Try not to drag your face in the gravel.
Bry Man is offline   Reply With Quote
Old 12-20-2004, 06:06 AM   PM User | #10
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
Ah, yes, I had to do the same thing, I swear thinking of what to do is harder than actually writing the program lol
__________________
-Brando
Why using tables for eating is stupid!
Brandoe85 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:14 PM.


Advertisement
Log in to turn off these ads.