Visual Studio Winform Tic Tac Toe Tutorial Example (C#)

Поделиться
HTML-код
  • Опубликовано: 14 дек 2024

Комментарии • 379

  • @corbinwilson3781
    @corbinwilson3781 2 года назад +9

    I’m in a c# class right now, and I’m geeking over the first 10 minutes of the video. It makes everything so much more practical and aesthetic.

  • @mrmiggins01
    @mrmiggins01 10 лет назад +12

    With no knowledge of programming what so ever, your series on tic-tac-toe is amazing. The way you just seem to reel the code out at will is impressive. I have a month off soon due to a planned amputation and your series is now going to give me something to 'have a go at' whilst I'm healing. I'm starting understand Excel more and have just started to experiment in VBA and have purchased a VBA for dummies book. Impressed...

  • @tkd2703
    @tkd2703 4 года назад +17

    2020 and this tutorial still rocks. Thanks man.. worked like a charm!

  • @RavensMultiverse-sq6lb
    @RavensMultiverse-sq6lb Год назад

    i have tried so many tutorials on tic tac toe and yourse is the only one that worked. Thanks man.

  • @mamsmelk
    @mamsmelk 4 года назад +3

    This tutorial might have been uploaded 6 years ago but it's still very helpful. I had to create a similar program for my Classes and this has put me in the right direction.
    So thank you!

  • @RollinShultz
    @RollinShultz 10 лет назад +1

    This is perfect for someone like me who has already taken courses in C++ and read up on C#. I don't need to start all over from the beginning, which is where most tutors start. I am following this just fine.

  • @usma1000
    @usma1000 10 лет назад +4

    Thank you so much for doing a PRACTICAL demonstration. I was getting so sick of learning the dictionary definitions of different programming elements. This is a great change of pace. I will definitely check out the rest of your channel.

  • @anasalbadi1792
    @anasalbadi1792 10 месяцев назад

    Thank you! This was one of the best guides I have seen in a while - keep up the good work and looking forward for new content

  • @minarizk727
    @minarizk727 8 лет назад +26

    Solving exception occurred when we want to disable buttons:
    private void disableButtons()
    {
    foreach(Control c in Controls)
    {
    if(c.GetType() == typeof(Button))
    {
    Button b = (Button)c;
    b.Enabled = false;
    }
    }
    }

  • @HI_Encore
    @HI_Encore 6 лет назад +9

    I am extremely grateful to you for this tutorial. The code is easy to understand. Your explanation is easy to understand as well. You have made the code nice and clean. I have a game to code in my finals tomorrow which is similar to tic tac toe so this tutorial helped me a ton!
    Thanks.

  • @BOSSTOMI2
    @BOSSTOMI2 10 лет назад +4

    I LOVE YOU MAN, YOU REALLY SAVED ME, Not because I copyed your code, I truly understanded it! THANKS!
    Keep doing video-examples like this one, please!

  • @naman_solanki
    @naman_solanki 5 лет назад

    Why people dislike this kind of very educational videos...

  • @kamilmikua5794
    @kamilmikua5794 4 года назад

    Wow the code is very clear and elegant. I have watched this with pleasure

  • @chrismerritt7291
    @chrismerritt7291  11 лет назад +14

    A continuation of this video is available at: (Part 2) Visual Studio Winform Tic Tac Toe Tutorial Example (C#). It adds two features, (1) to keep track of the number of times X, O wins and the number of draws, and (2) to show who's turn it is.

    • @chrismerritt7291
      @chrismerritt7291  10 лет назад

      ***** the data type bool is relative to the language you are using, not what version of C#. You sure you didn't create a VB.net project vice a C#.net project?

    • @chrismerritt7291
      @chrismerritt7291  10 лет назад

      *****
      Yah, I think MS breaks out different flavors of studio express. There's a web version and a Windows Desktop version. www.visualstudio.com/downloads/download-visual-studio-vs

    • @chrismerritt7291
      @chrismerritt7291  10 лет назад

      *****
      I don't use VS express, I use a full version of Visual Studio. All of my videos so far are winform tutorials with the ASP.net mail app being the only exception. If you want to try and tackle most of these videos, get the Express version for Windows Desktop.

    • @chrismerritt7291
      @chrismerritt7291  10 лет назад

      ***** Hey..not sure. I would google it to see the lowest price you can find. If you are a student, you can probably find it pretty cheap.

    • @GlentoranMark
      @GlentoranMark 10 лет назад +1

      Chris Merritt If you are a student you can get it for free via Dreamspark

  • @erik_mk
    @erik_mk 7 лет назад +1

    Great tutorial.. thanks a million... just started learning C# and this finally gave me a sense of getting somewhere with a practical exercise!

  • @wadeostrum9639
    @wadeostrum9639 4 года назад +1

    Chris you can select all the buttons before typing button_click

  • @naxu445
    @naxu445 2 года назад

    Awesome tutorial! Helped me with my school project!

  • @shadsluiter
    @shadsluiter 8 лет назад +2

    Nice tutorial series on C#. I am using the Tic Tac Toe project for a high school programming class. The pace and difficulty works well for new programmers. How about some new projects in the same line of work. Games - connect 4, checkers, card games such as war or memory?

  • @Jore__
    @Jore__ 8 лет назад

    2 year old video and it still kicks ass! Thank you for this, you are awesome :)

    • @b3rkay
      @b3rkay 3 года назад

      4 year old comment and it still kicks ass! Thank you for this, you are awesome :)

  • @dionease3749
    @dionease3749 4 года назад

    You saved my end of the year project, although im not doing tic tac toe, i never learned how to program games or different thing. You enlightened me!!

  • @michaelmueller1549
    @michaelmueller1549 Год назад

    Very nice job at explaining what is going on. I really like this tutorial helped me to better understand how C# works and also how to design my own gui

  • @andrewwhite310
    @andrewwhite310 8 лет назад +1

    Instead of changing the button text to "", it is a better practice to make use of `.Empty`. It makes it a little bit easier for someone else to read the code.

  • @maestro6873
    @maestro6873 3 года назад +2

    you can do it without he whole DisableButtons function. just put your buttons in a table layout and disable it at the there_is_a_winner function :)
    correct me if i'm wrong

  • @mynameispatrickandiliveund7628
    @mynameispatrickandiliveund7628 7 лет назад +2

    can u explain the Button b = (button)sender; part again? i did not understood it, what exactly does it do?

  • @pubgkiilerpro5244
    @pubgkiilerpro5244 2 года назад

    Amazing Tutorial to follow!

  • @method9706
    @method9706 8 лет назад

    what I would recommend in 2013 users is take the button text clear and put it before the button text enable as otherwise it flashs

  • @Bluadlatschn
    @Bluadlatschn 9 лет назад

    Best tutorial I have ever seen!!!

  • @halphillips1775
    @halphillips1775 Год назад

    This was very helpful, thank you

  • @isagive
    @isagive 9 лет назад

    Thanks, great demo for new novice in c#

  • @vikrampanchal7943
    @vikrampanchal7943 7 лет назад

    Thank you so much Chris Merritt. It helped me a lot in making the same.

  • @andrewsercer9538
    @andrewsercer9538 2 года назад

    Starting a project to build a kakuro game (c# winform) and needed a little bit of inspiration for creating the ui do watching this tutorial for some hints
    Don't know if there's even kakuro tutorials out there and don't want to look because I only want hints and ideas, not specific copy/paste code.
    So hopefully this will help.
    Edit: great! this gives me ideas for how to tackle several different methods, and a template for how to initialize the ui. I wasn't sure what the best way to allow the user to interact with the ui: buttons will probably work fine enough.

  • @filipapinski7464
    @filipapinski7464 7 лет назад +5

    hi Chris, i'm watching your Tutorial. I write to you because i have little question.
    After win X or O, we can still push the buttons, i try disable this, because i can't :/
    Little help? ;)

    • @pratikkumarsingh9745
      @pratikkumarsingh9745 4 года назад +1

      ARE YOU LEGIT DUMB HE FIXED THAT IN THE VIDEO

    • @rxn7
      @rxn7 4 года назад

      wdym by "i write to you" ?

  • @sameedabdulquddoos0257
    @sameedabdulquddoos0257 3 года назад

    thanks a bundle, helped alot in my assignment

  • @amrmoneer5881
    @amrmoneer5881 7 лет назад

    you're a great teacher!! god bless you

  • @jeroenboot8363
    @jeroenboot8363 9 лет назад

    Thanks Man!! You really helped me out learning C# and Visual Studio!

  • @djline2
    @djline2 11 лет назад +4

    wow, well I thought this was going to be easy. Just started a course at college. C# I kind of got stuck but completed it. Anyway thanks I probably learned some more code then i would on a easier tic tac toe tutorial.

    • @jit4806
      @jit4806 5 лет назад

      lmao you still in college my dude?

  • @GeorgiiieGirl
    @GeorgiiieGirl 10 лет назад

    Super helpful, enjoyed creating this - thanks!

  • @oleh5555able
    @oleh5555able 8 лет назад

    Oh, my english isn't well, but I have understood almost everything that you explained. Thx

  • @RisingPhoenix0
    @RisingPhoenix0 9 лет назад

    Great Tutorial Chris! Keep it up!

  • @vishwasbhatt6641
    @vishwasbhatt6641 2 года назад

    Thanks Bro.
    Easy To Understand.

  • @parthmehta1950
    @parthmehta1950 2 года назад

    it was easy to understand very well thank you

  • @chintu143ish
    @chintu143ish 10 лет назад

    Chris Merritt can i use text box rather than buttons..

  • @mathieuvincent6664
    @mathieuvincent6664 5 лет назад

    Thank you very much!!!!Excellent job.

  • @azzassfa
    @azzassfa 8 лет назад

    Excellent video ! thank you !!!
    I really enjoyed creating tic tac toe :)

  • @brunaalvaraes8372
    @brunaalvaraes8372 7 лет назад

    At 26:00 when you are writting to disable the buttons, why do you write "try" and "catch"?
    i would need a noob explanation cuz im really new at this.
    Thanks.

  • @robertbruce4362
    @robertbruce4362 10 лет назад

    Hi. I am trying to convert the disableButtons method to VB. The part the loop "Foreach (control c in controls)" section at around 24:45 on the timeline is what I am trying to conquer . Can anyone help with that? (I got around it by disabling each button separately, but of course the foreach loop method would be better). Thanks.

  • @nediaoken
    @nediaoken 6 лет назад

    thank you for this tutuorial. i was very helpful.
    you explain it just like someone that has never programmed before understand it
    go so on

  • @raghooda7667
    @raghooda7667 9 лет назад

    Thanks.. you make it so simple

  • @zenhaa
    @zenhaa 3 года назад

    Very good video! thank you very much!

  • @chtulurr
    @chtulurr 2 года назад

    cool tutorial!

  • @usama57926
    @usama57926 6 лет назад +4

    sir please make video on on-screen keyboard

  • @Brumljw
    @Brumljw 10 лет назад

    great video, lot of fun to do, thanks:)

  • @almaskhan2716
    @almaskhan2716 8 лет назад

    thank you sir, I really get the logic and made it using picture box.

  • @ghsegal
    @ghsegal 6 лет назад

    Is there a way to load previous game outcomes? I mean showing each players exact move for a winning game without a database?

  • @susymurguia4998
    @susymurguia4998 10 лет назад

    You've just saved my life! You have the perfect voice for this kind of videos, so firm... plus the ability you have to teach. You're great, thanks. Do you have other tutorials for begginers?

  • @eliomarjj
    @eliomarjj 3 года назад

    Olá!
    Tentei escrever seu código, acompanhando este tutorial, e ao escrever a rotina de um novo jogo, no meu caso, só apaga os botões A2 e A3.
    por que isso acontece?
    "Helo!
    I tried to write your code, following this tutorial, and when writing the routine for a new game, in my case, just delete the A2 and A3 buttons.
    Why does it happen?"

  • @sabaal-bashiri5619
    @sabaal-bashiri5619 4 года назад

    Amazing thank you so much for the tutorial

  • @arunshekhawat4317
    @arunshekhawat4317 9 лет назад

    fantastic video !!!

  • @vladlandcovschi356
    @vladlandcovschi356 10 лет назад

    Great work. Thanks for tutorial!!

  • @100yrsdeath
    @100yrsdeath 10 лет назад

    Chris could you please reply to this, is there another way to do this without using the button b = (button)sender; ?

  • @nouyang7630
    @nouyang7630 4 года назад

    How would your clear the board if you didn't have new game?

  • @tofu3129
    @tofu3129 2 года назад

    Thanks for this!

  • @khalilmohammadmirza4070
    @khalilmohammadmirza4070 8 лет назад

    thanks smith
    I have question . Will it affect the game program if i am working on Visual Studio 2015.
    In my everything seems to be except DisableButton . Please help me out on this one .
    P.S. i am new to programming

  • @jyotid8655
    @jyotid8655 7 лет назад

    Nice.......very simple.......Thank you............!!

  • @jennifer10112
    @jennifer10112 8 лет назад

    This was very helpful

  • @Yoroiful
    @Yoroiful 9 лет назад

    Thank you so much! It helped me a lot.

  • @desistang8794
    @desistang8794 9 лет назад

    Wow awesome, thank you for this video. i am building a "5x5x4" tic tac toe, the problem i am having is this:My buttons are not being disabled even after either "x" or "o" wins. i add disable button code exactly as you showed, still no luck

  • @haha55661
    @haha55661 10 лет назад

    Can i ask why my new game n disable button will malfunction at the last ? They all work well before

  • @GlentoranMark
    @GlentoranMark 10 лет назад

    It's been 25+ years since I've programmed ZX BASIC (spaghetti coding) and I'm totally new to OOP. Most other tutorials have come from first steps, describing things like variables and arrays which I'm already familiar with.
    This is just what I need, a top down approach describing a program from start to finish. There are some things I don't understand but I can understand the majority of what you say. I've still to look at more of your work Chris but this has been really useful for me.
    One thing if you haven't already put it on RUclips. Could you describe the design stage? You dive straight into coding but you had to come up with the idea for Tic Tac Toe somewhere. I know it's a simplified game but for more complicated projects then you must write things down. How would you go about it?

  • @my5ticdrag0n
    @my5ticdrag0n 7 лет назад

    great tutorial!

  • @letsmakeittothetop
    @letsmakeittothetop 8 лет назад

    Is there any algorithm being used in this??? PLEASE TELL

  • @usama57926
    @usama57926 6 лет назад +4

    sir please make video on MP3 player in C#

  • @suepark2278
    @suepark2278 8 лет назад +1

    Thank you so much Chris. You helped me to understand tic-tac-toe game very easily.
    I followed your tutorials, but I have weird mistake. In the checkForWinner method, messageBox pop-up 10 times... Where am I need to check for this mistake? Thank you and I'll see you at next tutorial ! :)

  • @UnsoundMrBlaze
    @UnsoundMrBlaze 9 лет назад +1

    Thanks for the video! I was overwhelmed at first, because it looked more complex than Python. However, all went well! Again, thanks!

  • @thecheater5121
    @thecheater5121 3 года назад +1

    what is bool?

  • @vinzent3864
    @vinzent3864 8 лет назад +1

    Very good tutorial :)

  • @jemy_tube
    @jemy_tube 5 лет назад

    your video is awesome and useful it is a good lesson for beginners like me ...... Can I ask you a question, please I started learning C# by creating Console apps but I spent about 1.5 month till now using this way ...... is moving to another method like this good for me now ? or not ? I can declare functions and reuse them ... please I am waiting for your answer

  • @shredhappy101
    @shredhappy101 9 лет назад

    I would recommend using an enum for button states and saving the states in an array. It would make checking for a winner much cleaner. Something like this for the first horizontal row:
    if (S[0] == S[1] && S[1] == S[2] && S[0] != STATES.NONE) return S[0];

  • @hatrungphamnguyen202
    @hatrungphamnguyen202 10 лет назад +1

    If somehow we have a winner in 9th turn, the "Draw" message box still shows. I just add a return there.
    Thank you for this tutorial, it helps me a lot.

    • @Prodbychrisp
      @Prodbychrisp 5 лет назад

      you can just add "if (!is_there_a_winner)" (not sure if its the right variable, i named my just winner and i didnt watch the vid again after the fix) one line above the message box which says its a draw

  • @AliHSyed
    @AliHSyed 6 лет назад

    Awesome, thanks for the video

  • @danielbange7694
    @danielbange7694 8 лет назад

    I have to write code for the game Connect Four. Do you have any tutorials on that? If not, can the logic for Tic-Tac-Toe be transferred?

  • @marcusmanning8653
    @marcusmanning8653 4 года назад

    Hello I have a question, I have everything working but my messagebox won't show up when I have a winner, what may be the issue?

  • @dattheboss1268
    @dattheboss1268 8 лет назад +1

    How can you replace the X and O with images with png, or jpg.

  • @IrishDragon_AoF
    @IrishDragon_AoF 8 лет назад

    8:45 Adding ; caused an error in VB 2015. Also, I am not seeing a lot of that code you have in your box. Not sure why. Also, your file name is .cs, mine is .vb. Not sure if any of that is a problem.

  • @benjamindrobert
    @benjamindrobert 9 лет назад

    Excellent thank you a lot. Very well explained

  • @abdulrehman-dv9ul
    @abdulrehman-dv9ul 9 лет назад

    can you post the code when i write the code for check i click one button the winner show up and i did it just like in the video but the problem isn't fix

  • @codelinker6318
    @codelinker6318 8 лет назад

    What a beautiful old times the first game I ever created with visual basic

  • @johann-andreasspindler7370
    @johann-andreasspindler7370 10 лет назад

    How did you want to do the result in a forech part, like you started and then left it at minute 16?

  • @soundrogue4472
    @soundrogue4472 4 года назад

    Any system where DRY is going to be a factor in your code?

  • @Lexyvil
    @Lexyvil 8 лет назад

    Very neat tutorial~

  • @Watode07
    @Watode07 2 месяца назад

    Hello i actually made this and the disable buttons function isn't working in the project I made even though the code is exactly the same as yours. I have a project coming up this Monday, can you please help out??? It would mean a lott

  • @lukaborovac6529
    @lukaborovac6529 5 лет назад

    Thank you a lot you made my dayy

  • @Ultraluxe
    @Ultraluxe 4 года назад

    Thank you very much for your helpful video)

  • @amgappsolution4587
    @amgappsolution4587 7 лет назад

    How can i disable just the X && O Buttons and let the others actions in function?

  • @alexfiggett7780
    @alexfiggett7780 7 лет назад

    my code doesnt work but ive got no errors, any suggestions pal? the disablebuttons section i have the exact same code but it does not disable them

  • @robertbruce4362
    @robertbruce4362 10 лет назад +1

    Hi...I am trying to convert this to VB. How can I do the casting part into a button? (The usual way is to code each button separately, but this idea is nice). Does anyone know how to convert this casting part to VB?

    • @robertbruce4362
      @robertbruce4362 10 лет назад

      hey I got it from another video. DirectCast(sender,button).text = "X"
      thanks for these videos.

  • @caswellkuhlase5769
    @caswellkuhlase5769 8 лет назад +1

    make a turial example for C#, code the game Tic tac toe and apply the following modification.
    -Instead of a X or O, use sprites. Have 2 different sprites to represent each sides (Player A and Player B).
    -You must have 3 instances of each sprite for each player to use.

  • @mehedyshojib9493
    @mehedyshojib9493 9 лет назад

    Thanks,its helped me a lot.........

  • @kimberlykesslar8360
    @kimberlykesslar8360 8 лет назад

    Hello. I am having problems when you go to click a new game. When I do that, my form will not allow me to start a new game. When I click on new game, all my boxes are grayed out and it won't let me do anything. Not sure what I'm doing wrong. Can you help me? Thank you!

  • @samerkhaled2443
    @samerkhaled2443 3 года назад

    Very impressive thank you alot 😍