Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    California
    Posts
    511
    Thanks
    1
    Thanked 1 Time in 1 Post

    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.

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Can you maybe post some code?
    OracleGuy

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Location
    California
    Posts
    511
    Thanks
    1
    Thanked 1 Time in 1 Post
    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.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #5
    Regular Coder
    Join Date
    Sep 2002
    Location
    California
    Posts
    511
    Thanks
    1
    Thanked 1 Time in 1 Post
    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.

  • #6
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    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.

  • #7
    Regular Coder
    Join Date
    Sep 2002
    Location
    California
    Posts
    511
    Thanks
    1
    Thanked 1 Time in 1 Post
    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.

  • #8
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    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

  • #9
    Regular Coder
    Join Date
    Sep 2002
    Location
    California
    Posts
    511
    Thanks
    1
    Thanked 1 Time in 1 Post
    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.

  • #10
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Ah, yes, I had to do the same thing, I swear thinking of what to do is harder than actually writing the program lol


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •