Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Gill Bates's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Location
    /online
    Posts
    1,135
    Reputation
    188
    Thanks
    247

    Post SIMPLE, FUN MPGH APPLICATON WITH TUTORIAL AND SOURCE CODE

    To learn how to program, one of the most important things to know is what your tools do.
    Learning how to program can be be very confusing, frustrating, time-consuming, but fun.
    If you are trying to learn how to program "to be a hacker", you are not necessarily in the wrong place (because knowing how to program CAN help you in a way), but will probably learn/benefit more by looking up penetration testing/networking and go from there.


    GETTING FAMILIAR WITH YOUR ENVIRONMENT:
    Some of you may want to start learning how to program, but are wondering, "How do I get my program to LOOK like something?"
    Well, Visual Studio lets you design (GUI), write/edit your code, debug, and compile your application.
    Visual Basic is an IDE(Integrated Development Environment)
    • Code Editor: This is what you need to write and edit your code for your application. In other words, this is the application's brain, which tells it WHAT and HOW to do something.
    • Debugger: Looks for any mistakes/bugs in your code, such as syntax errors (typos). This does NOT include logical errors (When the application works, but not how you want it to.)
    • Compiler: Converts source code from whichever language you are using, in this case, Visual Basic, to machine code (language that your computer/processor can actually read.)
    • GUI editor/builder: Lets you design the way your application will look to users. (What/how many buttons there will be, where they will be located, etc.)


    Important::
    Before a programmer starts making something, they have to have an objective in mind, and know what they want their program to do.
    A good idea is to brainstorm for a few minutes and have a general idea of how you want it to be layed out.
    Look into Pseudocode, and familiarize yourself with it.
    We won't go too into this phase, but it is one of those practices that will help you develop into a better programmer.


    Here, we will be making an applicaton with 4 Buttons, 1 PictureBox, 4 Timers and 1 Label.
    The application will have two pictures, which will be displayed when you click the button for each.
    There will be a "Pepe" and "MPGH" button, as well as an "Exit" button.
    We will also include an "Extra Feature" button, which makes the appliction flash in random colors when pressed.
    Lastly, a Label which displays what picture is being displayed.



    My symbols: '>' just means that this is the next step

     
    • Open up Visual Studio > Go to File > New > Project > Chooose Visual Basic as language > Windows > Windows Forms Application > Name it something like "First Project" > Click OK
    • Open up your Toolbox > AutoHide it (next to the 'X')
    • The toolbox contains everything you can put in your application

    https://i.imgur.com/KJgHFlo.png







    LET'S GET STARTED
    • Add 4 Buttons to your Form (foundation). You can simply add them by dragging it to your Form.
      https://i.imgur.com/2oXIhb5.png

      Now let's Name the buttons and change their Text.
    • On the right side side of your screen you will see Properties. This is what shows you the properties of everything in your Form.
    • To see an object's properties, you must click on it, in order for it to be selected.
    • In order to make things easier for yourself, make sure the properties are displayed in Alphabetical order, by clicking the icon that has an A and Z:

    https://i.imgur.com/2v3Arnz.png
    • Click on Button1 > Go to Properties > Text > Replace "Button1" with "Pepe" > Press Enter
    • Now, change Button2's Text to "MPGH".
    • Button3 = "Exit
    • Button4 = "Click Me for Sex!"


    Note: The Name property is different than the button's Text property.
    Name = for your/computer's reference
    Text = the actual TEXT in the Button that users will see. (Pepe, MPGH, Click Me for Sex!, Exit)


    Let's add a PictureBox to our Form. This will include the images that will pop up when user presses the button for it.
    • The PictureBox is located under Common Controls Section
    • We need to add images into the PictureBox, so download the files I attached.
    • Select the PictureBox on your Form and click the small arrow on the top right of it > Choose Image > Import > Import Both Pictures

    https://i.imgur.com/0wFgEUt.png


    -You will see that the picture does not fit
    -Select the PictureBox, click the arrow > Size Mode > StretchImage
    https://i.imgur.com/53Wz15Q.png




    We need to add a Label above the picture
    -Toolbox > Common Controls > Label
    https://i.imgur.com/FikpIP4.png





    ORGANIZATION:
    • If you haven't noticed yet, our interface does not look organized, much less, appealing to users.
    • Organize your interface to something that looks more professional. You can choose to set it up how I have it below, or however you'd like.
      https://i.imgur.com/09M9pcG.png
    • You can resize everything by dragging it from the corners.
    • To center an object, go to Format > Center in Form > Choose an option (I chose Horizontally)
    https://i.imgur.com/ozu93dw.png


    Before you start writing code, let's change our Objects' Name to something easier for us to work with when we are coding.
    -Example: Without renaming our Buttons, they are named Button1, Button2, Button3, and Button4.
    This might seem easy to remember which one is which, to some, but if you are working with many more Buttons in the future, it will be extremely difficult, counter-productive, and annoying.
    • Click on the Pepe Button > Go to Properties > Change the (Name) to "btnPepe"



    • Now do the same for all other Buttons, Labels (lblName), and PictureBox (picBox)
    • For my extra features Button, I renamed it "btnSex"
    • I did not change the Name of my Form, just because it is my only Form. I did change the text.


    To enable the extra feature:
    • Add 4 Timers to the Form
    • Drag them anywhere in the Form, they will beplaced in the bottom, "outside" the Form
    • They are located in the Components section of the Toolbox

    https://i.imgur.com/65Av8Bo.png

    Timers are literally timers; they count to a certain number of milliseconds, then tell the computer to perform a specific action when it reaches X amount of milliseconds. Remember, these count in milliseconds, so when using them, be wary of this. 1 second = 1000 milliseconds.
    Notice how when you drag a Timer to the Form, it does not go on the actual Form itself, but in the bottom, outside of the Form. This is because the Components are features in your application that the user cannot see. They are "internal".


    ADDING CODE:
    • Now for the fun part!
    • Let's start writing code for our Buttons.
    • To go to the Code Editor window, you just double-click on an object that you want to write code for.



    Exiting:
    • Double-click the Exit Button

    Code:
    Write : Me.Close()
    https://i.imgur.com/wUPev7T.png
    • This tells the computer that you want Form1(Me) to close(.close).
    • 'Me' is a class. In other words, it is basically "pointing" at something(in this case, Form1).
    • After the computer "points" at/locates Form1, it closes(.Close) it




    • Now double-click on the Pepe Button and add:


    Code:
    picBox.Image = My.Resources.Pepe
            lblName.Text = "Pepe"
    -In short, "Private Sub btnPepe_Click(sender As Object, e As EventArgs) Handles btnPepe.Click" tells the computer to do a certain
    thing when the button(btnPepe) is clicked(.Click).
    -It tells it to go to your PictureBox(picBox), display an image(Image), which is located (=) in your Resources(My.Resources) file(check the Solution Explorer to see it),
    under the name 'Pepe'(.Pepe).
    -Then it tells the Label(lblName) that its text must be Pepe ("Pepe")



    Extra Feature:
    -Double click the Button for the extra features and write the following:
    Code:
    Timer1.Enabled = True
    -In Timer1, write:
            Me.BackColor = Color.Blue
            Timer1.Enabled = False
            Timer2.Enabled = True
    -In Timer2, write: 
            Me.BackColor = Color.DarkRed
            Timer2.Enabled = False
            Timer3.Enabled = True
    In Timer3, write:
            Me.BackColor = Color.White
            Timer3.Enabled = False
            Timer4.Enabled = True
    In Timer4, write:
            Me.BackColor = Color.Black
            Timer4.Enabled = False
            Timer1.Enabled = True
    This is a fairly simple code. The True/False parts of it are Boolean Expressions. This just means that our our expression (in other words, command) results in either being False or True. You can think of False/True as Off/On for this project.
    In our code above, the computer is being told, 'for Timer1, switch the background color(BackColor) to Blue, then disable(Timer1 = False) Timer1, and enable Timer2(Timer2=True)'. After it does this, it goes on to the next command, which is Timer2. Timer 2 switches the color again, and does the same thing over and over until it reaches Timer4's end. After that, it goes back to the top and performs it from the beginning.

    Each Timer switches the Form's(Me) background color(.BackColor) to a different one.
    In the Properties, you can change the Interval to less/more than 100(currently) to make it flash faster/slower.

    All of this code seems hard to remember, right?
    That is where Code Snippets come in handy!
    Code snippets are small pieces of code to remind you of what a function does. They are can be used by anyone using the same programming language.

    Go ahead and mess with the program to experiment and learn more.
    Never stop learning!



  2. The Following 7 Users Say Thank You to Gill Bates For This Useful Post:

    DadDelta (10-03-2015),Edible Cyanide (03-14-2017),fortuneeee (12-06-2015),OscR (10-20-2015),Romesh Dilshan (11-12-2015),Ticherhaz (12-31-2015),vm91 (02-17-2020)

  3. #2
    Mayion's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Location
    Bed
    Posts
    13,502
    Reputation
    4018
    Thanks
    8,368
    My Mood
    Twisted
    Explaining what a timer is, and the boolean statements (True and false) would make the tutorial even better. But I like the introduction, good job.
    I do not use any type of messenger outside of MPGH.
    Inactive but you can reach me through VM/PM.










     

    Donator - 30 August 2013
    Battlefield Minion - 26 October 2013

    Blackshot Minion - 14 January 2014/16 September 2014
    Minecraft Minion - 7 February 2014/16 September 2014
    WarRock Minion - 23 February 2014
    League of Legends Minion - 21 March 2014

    Minion+ - 15 May 2014
    Other Semi-Popular First Person Shooter Minion - 8 August 2014
    CrossFire Minion - 23 October 2014
    Programming Section Minion - 13 November 2014
    Marketplace Minion - 7 December 2014

    Official Middleman - 7 December 2014 - 27 June 2015
    Moderator - 29 December 2014
    Project Blackout Minion - 10 January 2015
    News Force Interviewer - January 2015
    Steam Games Minion - 21 March 2015
    Dragon Nest Minion - 31 March 2015
    Publicist - April 2015 - 21 September 2015
    Global Moderator - 25 August 2015
    Super User - 13 August 2016



  4. #3
    Gill Bates's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Location
    /online
    Posts
    1,135
    Reputation
    188
    Thanks
    247
    Quote Originally Posted by Mayion View Post
    Explaining what a timer is, and the boolean statements (True and false) would make the tutorial even better. But I like the introduction, good job.
    I barely realized I didn't go over that.
    Time to edit. Lol
    Thank you.

    EDIT: Added this.

  5. The Following User Says Thank You to Gill Bates For This Useful Post:

    DadDelta (10-03-2015)

  6. #4
    FireBlzed's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Posts
    339
    Reputation
    10
    Thanks
    127
    Great tutorial man! Used to make things like this back in the days

  7. #5
    Gill Bates's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Location
    /online
    Posts
    1,135
    Reputation
    188
    Thanks
    247
    Quote Originally Posted by FireBlzed View Post
    Great tutorial man! Used to make things like this back in the days
    Back in the day?
    Spam post x100.

  8. #6
    Dab's Avatar
    Join Date
    Jun 2015
    Gender
    female
    Posts
    5,426
    Reputation
    663
    Thanks
    9,868
    Bad tutorial, should have specified Timers are not to be used in replace of Loops and have given an example of when to use a loop and the different ways to, as well as how you could delay that loop so it works like a timer.

  9. #7
    Gill Bates's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Location
    /online
    Posts
    1,135
    Reputation
    188
    Thanks
    247
    Quote Originally Posted by Dab1996426 View Post
    Bad tutorial, should have specified Timers are not to be used in replace of Loops and have given an example of when to use a loop and the different ways to, as well as how you could delay that loop so it works like a timer.
    I only explained what needed to be explained.
    In case you did not read it, I stated that instead of dissuading people from wanting to learn, I want to encourage them.
    When you get too into the vocabulary and other details that are NOT part of the app you are building, you get lost, bored, and eventually give up.
    That was not my purpose in this tutorial.
    Feel free to make your own application/tutorial for beginners.

  10. #8
    Dab's Avatar
    Join Date
    Jun 2015
    Gender
    female
    Posts
    5,426
    Reputation
    663
    Thanks
    9,868
    Quote Originally Posted by Gill Bates View Post
    I only explained what needed to be explained.
    In case you did not read it, I stated that instead of dissuading people from wanting to learn, I want to encourage them.
    When you get too into the vocabulary and other details that are NOT part of the app you are building, you get lost, bored, and eventually give up.
    That was not my purpose in this tutorial.
    Feel free to make your own application/tutorial for beginners.
    Actually I didn't even read your OP. You don't know how to code, don't post tutorials on how to use visual basic when you aren't elaborating on what needs to be said for noobs not to get the wrong impression and use faulty methods such as a Timer for looping through array data.

  11. #9
    Gill Bates's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Location
    /online
    Posts
    1,135
    Reputation
    188
    Thanks
    247
    Quote Originally Posted by Dab1996426 View Post
    Actually I didn't even read your OP. You don't know how to code, don't post tutorials on how to use visual basic when you aren't elaborating on what needs to be said for noobs not to get the wrong impression and use faulty methods such as a Timer for looping through array data.
    Sure, sure.
    Your feedback is appreciated. lol

  12. #10
    Dab's Avatar
    Join Date
    Jun 2015
    Gender
    female
    Posts
    5,426
    Reputation
    663
    Thanks
    9,868
    Quote Originally Posted by Gill Bates View Post
    Sure, sure.
    Your feedback is appreciated. lol
    Code:
    Sub FakeTimer(ByVal Interval as Integer)
    For Each Item in Array : threading.thread.sleep(Interval)
    If (not String = Item) then : 'Whatever
    End If
    End Sub
    There, I gave my feedback in codeform.

  13. The Following User Says Thank You to Dab For This Useful Post:

    Gill Bates (10-11-2015)

  14. #11
    OscR's Avatar
    Join Date
    Oct 2014
    Gender
    male
    Location
    Probably Bed
    Posts
    1,630
    Reputation
    325
    Thanks
    246
    My Mood
    Devilish
    Introduction is flawless man, really easy and simple for new people to coding. Great work!
    A҉F҉T҉E҉R҉ ҉4҉ ҉Y҉E҉A҉R҉S҉,҉ ҉I҉ ҉A҉M҉ ҉B҉A҉C҉K҉ ҉O҉N҉ ҉T҉H҉I҉S҉ ҉S҉I҉T҉E҉




  15. #12
    Gill Bates's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Location
    /online
    Posts
    1,135
    Reputation
    188
    Thanks
    247
    Quote Originally Posted by Whitehill View Post
    Introduction is flawless man, really easy and simple for new people to coding. Great work!
    Thank you.

  16. #13
    Romesh Dilshan's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    420
    Reputation
    10
    Thanks
    26
    My Mood
    Devilish
    Awesome tutorial

  17. The Following User Says Thank You to Romesh Dilshan For This Useful Post:

    Gill Bates (11-12-2015)

  18. #14
    Raul112's Avatar
    Join Date
    May 2013
    Gender
    female
    Posts
    116
    Reputation
    10
    Thanks
    8
    My Mood
    Lonely
    Quote Originally Posted by Dab1996426 View Post
    Code:
    Sub FakeTimer(ByVal Interval as Integer)
    For Each Item in Array : threading.thread.sleep(Interval)
    If (not String = Item) then : 'Whatever
    End If
    End Sub
    There, I gave my feedback in codeform.
    //Shots were fired

  19. #15
    Gill Bates's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Location
    /online
    Posts
    1,135
    Reputation
    188
    Thanks
    247
    Quote Originally Posted by Raul112 View Post
    //Shots were fired
    Buttttt do you even know what his code does / means?

Page 1 of 2 12 LastLast

Similar Threads

  1. [Source Code] Simples Menu D3D Class With Items and CheckBox's
    By gusdnide in forum DirectX/D3D Development
    Replies: 4
    Last Post: 02-23-2016, 02:12 AM
  2. RotMG Tutorials and Source Code Section Rules
    By krazyshank in forum Realm of the Mad God Tutorials & Source Code
    Replies: 0
    Last Post: 06-01-2015, 11:14 PM
  3. [Patched] (My First Hack) Simple Hack for CFPH - With Key And Sound
    By Jhem in forum CrossFire Philippines Hacks
    Replies: 48
    Last Post: 08-22-2012, 08:09 AM
  4. I bring you tidings of joy, and source code.
    By EpicPacMan in forum Combat Arms Discussions
    Replies: 24
    Last Post: 09-30-2009, 02:01 AM
  5. Stamina Hack and source code ?
    By Teh Sasuke in forum C++/C Programming
    Replies: 0
    Last Post: 12-31-2007, 05:08 PM