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 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB goto class command?

    I am learning Visual Basic and have got it figured out to some extent, my only problem is that I am trying to make the application go to a different class if a certain variable is set to 1, how would I do this?

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,817
    Thanks
    42
    Thanked 199 Times in 198 Posts
    Code:
    Module Module1
    
        Sub Main()
            Dim d As New demo
            d.doSomethingElse()
        End Sub
    
    End Module
    
    Public Class demo
        Sub New()
            doSomething()
        End Sub
        Private Sub doSomething()
            Console.WriteLine()
        End Sub
        Public Sub doSomethingElse()
            Console.ReadLine()
        End Sub
    End Class

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #3
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    great god, I suck at VB. Are there any video tutorials of this anywhere on how to set it up correctly? I am trying to set it up so that if you enter a correct password, it takes you to a GUI with functions binded to certain buttons.
    Last edited by jack10685; 02-04-2013 at 08:45 PM.

  • #4
    New Coder
    Join Date
    Jan 2013
    Location
    Canada
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    go to a different class if a certain variable is set to 1, how would I do this?
    I'm confused on this, you don't really jump or "go to" a different class, classes just perform various procedures if you have methods inside of them. You have an entry point, which calls a new instance of, by default Form1, and this is where your application runs.

    If, in the settings you configure it to close upon the last form, or when the first form closes, it's possible to close the form associated with the initial startup form and run code only in the next form, lets say called Form2, but typically all other classes just run code for you, simultaneously while your main Form code still runs in the background; listens for events, etc...

    Instead of explaining what your problem is, and especially since you're just starting out, lets go with something a bit more appropriate so we can help you out: What are you trying to achieve?

    I ask this because most of the time, the user has an issue, and because they don't truly understand how they should be doing what they are trying to do, it's either an odd way of doing it, or it's wrong.

  • #5
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,817
    Thanks
    42
    Thanked 199 Times in 198 Posts
    Quote Originally Posted by jack10685 View Post
    great god, I suck at VB. Are there any video tutorials of this anywhere on how to set it up correctly? I am trying to set it up so that if you enter a correct password, it takes you to a GUI with functions binded to certain buttons.
    I don't know of any tutorials... I don't know how you are doing this either, but what you want to look at is the http redirect method.

    So...
    Code:
    If *evaluate some condition* Then
      Response.Redirect("MyAuthenticatedPagePath")
    Else
      Response.Redirect("AuthenticationDeniedPagePath")
    End If

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #6
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by alykins View Post
    I don't know of any tutorials... I don't know how you are doing this either, but what you want to look at is the http redirect method.

    So...
    Code:
    If *evaluate some condition* Then
      Response.Redirect("MyAuthenticatedPagePath")
    Else
      Response.Redirect("AuthenticationDeniedPagePath")
    End If
    would the path be a class, or a different .vb file within visual studio?

  • #7
    New Coder
    Join Date
    Jan 2013
    Location
    Canada
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It would be a Form class, but first you need to understand why alykins posted something about an HTTP Request for this. I believe what he's trying to do there is to do the validation trhough some online place to decide whether to show a Form?

    The benefit of this is because .NET is not very secure lol... It can be decompiled quite easily. You DO NOT want to have your password validation against a plaintext password hardcoded into the app itself. Regardless, I bet you I could still get around this HTTP Request validation if I really wanted to, because all of the instructions for when and if you are validated, still exist within the app itself. It would be a simple "jmp" instruction most likely to bypass the validation completely.

    If you're just beginning in .NET though, you don't have a hope of making your app 100% secure, that's all I can say. Not because you're "terrible" by any means. Protection in .NET is actually pretty complex to achieve. Actually, this is true in most other languages too. With an advanced reverse engineer you'd almost have no chance.

    Lots of people choose to have an online SQL database though for validation, and your app sends a request and receives a response as to whether you are validated or not...

    The data is stored as a hash, and the input from the program is hashed to compare with the hashed value in the database to test for equality. If they match, then Show the new Form(), otherwise, show an error message?

    Thus you can obviously see that we need an If statement here. Hope that helps...
    Microsoft MVP .NET Programming - (2012 - Present)
    ®Crestron DMC-T Certified Automation Programmer & Software Developer


  •  

    Posting Permissions

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