Results 1 to 5 of 5
  1. #1
    Per Aspera Ad Inferi ellijah's Avatar
    Join Date
    Aug 2011
    Posts
    5,618
    Points
    8,667
         User Info     Contact     Gamer ID
    Join Date
    Aug 2011
    Posts
    5,618
    Points
    8,667

    Default [TUT#1]Visual Basic - Declaring a variable as a string

    For the first example we will declare a string using a message box.


    Open Visual Basic and click "new project" then name your project and click "windows form". When the form opens go to the toolbox tab on the left and click "Button".


    Now click the form and a button will appear on it, resize your button as you feel needed. I will teach you how to customize buttons and such in later tutorials.

    Double click your button and you will get a screen like this.

    This is where all of your "coding" will be done.

    Under "Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click" write "MessageBox.Show()".


    Now under "Public Class Form1" Write "Dim blahblahwhatthefuckever As String = "Omg I just declared a valiable""

    Now to explain that, Dim is what you use to declare something. blahblahwhatthefuckever is the variable I am declaring(it can be titled anything you want), and As String means I am declaring it as text(aka a text string). The "Omg I just declared a valiable"" is just what we want our message box to say.


    Now go back to your "MessageBox.Show()" and copy and paste your variables name in the () like this.
    MessageBox.Show(blahblahwhatthefuckever)

    So what we are saying is that when button1 is clicked we are declaring our variable "blahblahwhatthefuckever" as a text string in a message box.

    Now lets test it, click the play button on top like in this picture.


    This should be your result when you click Button1.



    Congratulations, you have just declared your first variable.

    0 Not allowed! Not allowed!

  2. #2

    Retired Prophet
    ToxicJew.'s Avatar
    Join Date
    Mar 2011
    Location
    S̢͎̳̞̲͈̪̳̻ͮͩt̟̳̏ͬ̔&#
    Posts
    7,802
    Points
    7,609
         User Info     Contact     Gamer ID
    Join Date
    Mar 2011
    Location
    S̢͎̳̞̲͈̪̳̻ͮͩt̟̳̏ͬ̔&#
    Posts
    7,802
    Points
    7,609

    Contact info:

    Youtube Channel: http://www.youtube.com/kennethbgoodin

    Default

    Hm, this is simple enough. It's similar to Objective-C, in the way that you declare variables and name them.

    0 Not allowed! Not allowed!
    ส็็็็็็็็็็็็็็็็็็็็็็็็็༼ ຈل͜ຈ༽ส้้้้้้้้้้้้้้้้้้้้้้้ส็็็็็็็็็็็็็็็็็็็็ ็็็็็༼ ຈل͜ຈ༽ส้้้้้้้้้้้้้้้้้้้้้้้

  3. #3
    Per Aspera Ad Inferi ellijah's Avatar
    Join Date
    Aug 2011
    Posts
    5,618
    Points
    8,667
         User Info     Contact     Gamer ID
    Join Date
    Aug 2011
    Posts
    5,618
    Points
    8,667

    Default

    Yea, it's a very simple beginners tutorial. I will make more soon more difficult then this.

    0 Not allowed! Not allowed!

  4. #4
    just 'round the corner PoptartHunter's Avatar
    Join Date
    May 2011
    Posts
    4,588
    Points
    8,731
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Posts
    4,588
    Points
    8,731

    Contact info:

    Youtube Channel: http://www.youtube.com/PoptartHunterCL

    Default

    How would you code it if you wanted the text to pop up in a box that you can copy and paste from? (Like a custom class creator program of some sort).

    0 Not allowed! Not allowed!

  5. #5
    Per Aspera Ad Inferi ellijah's Avatar
    Join Date
    Aug 2011
    Posts
    5,618
    Points
    8,667
         User Info     Contact     Gamer ID
    Join Date
    Aug 2011
    Posts
    5,618
    Points
    8,667

    Default

    Without declaring a variable you could just use a button and a text box and double click the button and type this.

    TextBox1.Text = "Text goes here"

    So now when we click the button that text in quotations will show up in the textbox and your can copy and paste from textboxes.

    If you don't want a bunch of buttons and you just want to use a drop down box then you need a text box and a combo box, and to do this you need to use an if statement. I will explain if statements in my next tutorial which I will probably make tomorrow.

    0 Not allowed! Not allowed!

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -10. The time now is 10:27 PM.
Powered by vBulletin®
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.