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 02-01-2013, 12:36 AM   PM User | #1
jack10685
New to the CF scene

 
Join Date: Feb 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
jack10685 is an unknown quantity at this point
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?
jack10685 is offline   Reply With Quote
Old 02-01-2013, 02:02 PM   PM User | #2
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
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
alykins is offline   Reply With Quote
Old 02-04-2013, 08:24 PM   PM User | #3
jack10685
New to the CF scene

 
Join Date: Feb 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
jack10685 is an unknown quantity at this point
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..
jack10685 is offline   Reply With Quote
Old 02-05-2013, 07:27 AM   PM User | #4
AceInfinity
New Coder

 
Join Date: Jan 2013
Location: Canada
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
AceInfinity is an unknown quantity at this point
Quote:
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.
AceInfinity is offline   Reply With Quote
Old 02-05-2013, 11:53 AM   PM User | #5
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
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
alykins is offline   Reply With Quote
Old 02-05-2013, 08:54 PM   PM User | #6
jack10685
New to the CF scene

 
Join Date: Feb 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
jack10685 is an unknown quantity at this point
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?
jack10685 is offline   Reply With Quote
Old 02-06-2013, 04:22 AM   PM User | #7
AceInfinity
New Coder

 
Join Date: Jan 2013
Location: Canada
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
AceInfinity is an unknown quantity at this point
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
AceInfinity 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 05:10 PM.


Advertisement
Log in to turn off these ads.