Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Declaring Variables and Assigning Values - Day 1 - Part 9

Download

Right click “Save as…”

We now focus on learning the C# programming language. In this video, Bob explains variables and data types, as well as setting and retrieving variable values.

Download the source code in c#

Download the source code in VB.Net

Follow the Discussion

  • Good video but I ran into a problem. When you typed y.ToString square braces appeared at the end [ ] but that doesnt work for me, it does work however if I use the curved braces ( ), I don't understand why

  • Digital DaveDigital Dave

    I was also JUST watching the video and I watched the same thing and was about to comment on it. Really cool but can you please explain the () at the end and how, if we had not seen it we would have known to put the () at the end of the line.

  • TonyTony

    [quote]
    1 day ago
    I was also JUST watching the video and I watched the same thing and was about to comment on it. Really cool but can you please explain the () at the end and how, if we had not seen it we would have known to put the () at the end of the line.

    [/quote]
    It's part of the syntax of C# but you really didn't need to know that because when you put the . after y the intellisense auto-completion added the () to the end after you selected .ToString().  Visual Studio would have told you that this was a problem as well.  I think it even goes so far as to tell you that it expects parentheses.

  • Clint RutkasClint I'm a "developer"

    @Mintydog: brackets in a C style language like c# implies an index to an array or collection.  so if I had an array of integers called foo that has 10 objects, I'd go

    int firstInt = foo[0]; // returns first
    int fifthInt = foo[4]; // returns 5th in array

    Now () is typically for methods and constructors.  so if I have an a string, I'd go

    string myString = new string();

    If I have an integer and wanted to change it into a string, I have to cast it.  Since .ToString is a method, I have to do use () since some methods allow you to pass stuff in.  With (), I'm passing in nothing.

    int five = 5;
    string theNumberFive = five.ToString();

  • Joseph CloverJoseph Clover

    He did infact use 'toString()'. It is because of the video quality that it appeared as '[]'. :)

  • Clint RutkasClint I'm a "developer"

    @Joseph Clover: Ah, we do have the high quality versions and the source code examples for download as well for each video

  • KavitajKavitaj

    @Clint: Where can I find the high quality versions. The quality is pathetic in these. Can't read a word!

  • MisoMiso

    where can i change the settings to have these () after ToString,too?

  • TechieGirl1TechieGirl1

    This is too funny!

  • TechieGirl1TechieGirl1

    Clint,
    Just wanted to tell you I think you are doing a fantastic job with these videos. Thanks for putting these together for everyone.

    TechieGirl1

  • BradyBrady

    Totally new to all this but downloaded the latest tools (the beta) and it seems that the conventions for defining variables is different than the video. Using the Dim string instead of Int?

    I'm confused. Can anyone help?

  • BradyBrady

    Again, a total newbie but it seems like when I try to edit actions on a control I'm working in VB and he's working in C#. Does that make sense and how do I switch?

  • BradyBrady

    Nevermind, I'm a moron. Figured it out.

  • Thanks All these videos are great tutorials!

  • Good video, thanks.

  • Philip GoffPhilip Goff

    First off excellent video's, thanks for posting them.I am a total norvice, can you tell me how you convert doubles to string please.

    Thank you in advance.

    Regards Phil

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.