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

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ม.ค. 2025

ความคิดเห็น • 52

  • @SimBoter
    @SimBoter 10 ปีที่แล้ว +17

    2:00 you can select multiple items with shift + click and then wirite it only once

  • @brandonruffin6782
    @brandonruffin6782 7 ปีที่แล้ว +13

    Hi, the buttons are now clickable again after a win is set since we added the labels

  • @Fireflameful
    @Fireflameful 5 ปีที่แล้ว +3

    Late answer but for those asking why the buttons are clickable again after a win. It is the same as when the New Game menu item didnt work, put the try/catch inside the foreach loop on your disableButtons method and it should work fine!

  • @rodrigo6459
    @rodrigo6459 9 ปีที่แล้ว +3

    A better solution for the try/catch blocks will be to check if the controls are buttons or not with if(someButton is Button), and instead if using the buttons them self to indicate the turn for player X or O you can add a ToolTip control and assign it to the "mouse enter" with toolTip1.SetToolTip(b, "It´s player X turn");
    For the rest of the example... is REALLY good!, thnx a lot for putting this up.
    Request: Any chance this whole game can be redone with an OOP approach?.

  • @nediaoken
    @nediaoken 6 ปีที่แล้ว +1

    if your buttons are clickable again after adding the labels try to do the same step at "private void disableButtons" explained at 10:29 as what you did by new game.
    or replacing disablebuttons with this code:
    private void disableButtons()
    {
    foreach (Control c in Controls)
    {
    try
    {
    Button b = (Button)c;
    b.Enabled = false;
    } // end foreach
    catch { }
    } // end try
    }

    • @bawajeee
      @bawajeee 5 ปีที่แล้ว

      It shows error, modifier private is not valid
      disableButtons is declared but never used.

    • @bawajeee
      @bawajeee 5 ปีที่แล้ว

      Solved the errors. I love you man.

    • @yazanjordan3103
      @yazanjordan3103 3 ปีที่แล้ว +1

      It worked !! Thank you so much i was stuck in this for hours

  • @johndryer1785
    @johndryer1785 10 ปีที่แล้ว +2

    nice video bro, learning really well on your tutorials keep up the good work!! Have one question, when someone wins how do you make it not able to continue i notice if someone wins you can keep going on same game, i guess i'm trying to say is how can you lock the game so it wont continue until you click on new game

    • @robylplays
      @robylplays 4 ปีที่แล้ว

      you can simply disable all the buttons

  • @TheTDRaF
    @TheTDRaF 10 ปีที่แล้ว +1

    Maybe You can add same code in C++?

  • @RyanAlvinTekkerzplusLewis
    @RyanAlvinTekkerzplusLewis 3 ปีที่แล้ว

    brilliant!

  • @sachivluv4u
    @sachivluv4u 10 ปีที่แล้ว

    Thanks a lot i created the same game using your help provided. Keep publishing games and more on csharp codes like these.

  • @ninaANF
    @ninaANF 8 ปีที่แล้ว

    Thanks for sharing this tutorial. You helped me a lot and make me loveee c# :D :)

  • @illyabilous9024
    @illyabilous9024 9 ปีที่แล้ว

    Chris, you are best my man! ty for that tutorial!!))

  • @XGuardian_X1
    @XGuardian_X1 9 ปีที่แล้ว

    Thanks for sharing !!

  • @usama57926
    @usama57926 6 ปีที่แล้ว +1

    thank u sir

  • @tux_ad
    @tux_ad 8 ปีที่แล้ว

    Thank you!

  • @13danyocean13
    @13danyocean13 9 ปีที่แล้ว

    Hey. What about empty catch?)

  • @DawnTreaderPlaysEDO
    @DawnTreaderPlaysEDO 9 ปีที่แล้ว +1

    Just something I thought about when doing the first tute. I selected all the buttons after I entered the first button_enter and pasted. it put it on all buttons. I did the same for button_leave. you don't have to paste one by one.

  • @TonyPepperoni27
    @TonyPepperoni27 4 ปีที่แล้ว

    How can we make it an option to vs the computer?

    • @chrismerritt7291
      @chrismerritt7291  4 ปีที่แล้ว

      There are a couple follow up videos...the last one covers playing against the computer.

  • @cilithedoctor
    @cilithedoctor 9 ปีที่แล้ว

    Thank you!!

  • @rahimeinollahi1
    @rahimeinollahi1 6 ปีที่แล้ว

    thanks mr chiris

  • @alexcharlton2316
    @alexcharlton2316 11 ปีที่แล้ว +1

    Hey chris, Thanks for sharing this, I was just wondering if their would be an easy way to Allow users to enter their name when the game gets opened, and to be shown on the scoreboard instead of X Win Count and O Win count etc?

    • @chrismerritt7291
      @chrismerritt7291  11 ปีที่แล้ว +4

      Alex, Here ya go: (Part 3) Visual Studio Winform Tic Tac Toe Tutorial Example (C#) Hope this helps!

    • @alexcharlton2316
      @alexcharlton2316 11 ปีที่แล้ว +2

      Chris Merritt Thanks a lot, your a top guy :)

    • @bahiegildas5732
      @bahiegildas5732 9 ปีที่แล้ว

      +Chris Merritt Video 4 is not really clear (explicit) for people who not speak English

  • @banesekulic8119
    @banesekulic8119 11 ปีที่แล้ว

    Hello.The code is fine,but what when x or o wins the round?. It gives +1 to count,show message witch player is the winner and then what? :) It cannot count again,you need to press new game everytime. What if i want it to count until 10 wins? Thanks. Bane

    • @chrismerritt7291
      @chrismerritt7291  11 ปีที่แล้ว

      Hey Bane, If you wanted the game to automatically start a new game, the easiest way would be to add:
      newGameToolStripMenuItem.PerformClick();
      to each case when X or O wins (say right after the message box is shown) or after the message box for a draw is shown. That would be the simplest way. Of course there other ways to do that too. :)

    • @banesekulic8119
      @banesekulic8119 11 ปีที่แล้ว

      Chris Merritt
      Thank you :)

  • @DavidThörnqvist
    @DavidThörnqvist หลายเดือนก่อน

    9:34

  • @akashanil4540
    @akashanil4540 7 ปีที่แล้ว

    can u prevent the gray out of the disabled buttons bcoz it doesn't look nice

  • @skyz3ra
    @skyz3ra 9 ปีที่แล้ว

    hello, i was wondering, how do you change the color of the text if the button is disabled ? :(
    cuz i wanna mess around with the proprieties e.g. if the result is X then the font color will be red etc, but it doesnt do anything because the button is disabled, any way to disable only certain propreties like text instead of the entire button?

  • @77pizzas5
    @77pizzas5 7 ปีที่แล้ว

    Hi. Thanx for your videos. Wanted to ask about an exception unhandled with string format. This is referring to the Int32 and the Parse method for restting the score. When the score resets, the text in the count labels change to 0 and the becomes the counters. How do I fix it.....don't understand enough from reading my C# books. Please help

  • @shamimkhan5130
    @shamimkhan5130 10 ปีที่แล้ว

    thanks very much helpfull

  • @raitmaervlad9450
    @raitmaervlad9450 7 ปีที่แล้ว

    hello, how can you make it swap the between X and O (the one that starts) like, i chose x and my budy o, but if i get to start i know how to win... so how can i make it to change one turn starts O next one starts X.
    even better, how can i make it so i can chose who is to start?

  • @carlmunoz6346
    @carlmunoz6346 8 ปีที่แล้ว

    hello dude, im new to c# programming language. can i ask you a question? what if i set some winning patterns of buttons and deadlock buttons how do i do it?

    • @chrismerritt7291
      @chrismerritt7291  8 ปีที่แล้ว

      I'm not sure I follow what you're asking. You mean how to you preprogram moves by the computer player?

  • @Guard-Of-Zion
    @Guard-Of-Zion 6 ปีที่แล้ว

    Nice

  • @NewVidDotCo
    @NewVidDotCo 10 ปีที่แล้ว

    Wheres part 1?

  • @serjusg
    @serjusg 10 ปีที่แล้ว

    HI. I need a command wich reset the game after someone wons. Can someone help me. Thank you!

  • @rjc131
    @rjc131 9 ปีที่แล้ว

    I get an error right after we added the labels for the count, it says "An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
    Additional information: Input string was not in a correct format." it of-coarse highlights the x_Win_Count line as that was the winner., did I need to add a using statement?
    Thanks in advance.

    • @rjc131
      @rjc131 9 ปีที่แล้ว

      Robert Carlson Disregard my last post, I put the letter o instead of a zero in the label text properties

  • @hassengharbi107
    @hassengharbi107 9 ปีที่แล้ว

    svp lien de telechargement visual studio

  • @haulhaul9888
    @haulhaul9888 8 ปีที่แล้ว

    minimax algorithm?????

  • @codelyandmore
    @codelyandmore 6 ปีที่แล้ว

    Hey you should have more likes

  • @bahiegildas5732
    @bahiegildas5732 9 ปีที่แล้ว

    Video 4 is not really clear (explicit) for people who not speak English

  • @suppermanzzzz291
    @suppermanzzzz291 7 ปีที่แล้ว

    If you want to make a textbox to show whose turn, I have some ideas here : )
    private void Turns_Checker()
    {
    if (turns_count % 2 == 0)
    { Whose_Turn_TextBox.Text = "O"; }
    else
    { Whose_Turn_TextBox.Text = "X"; }
    }

  • @carlmunoz6346
    @carlmunoz6346 8 ปีที่แล้ว

    *deadlock patterns

  • @Parth9PTL
    @Parth9PTL 9 ปีที่แล้ว

    Just a tip, an easy to rest form and scores
    paste this in the rest score method
    newGameToolStripMenuItem_Click(sender, e);