Click here to Skip to main content
15,892,005 members
Home / Discussions / C#
   

C#

 
QuestionWinform MDI child form render not properly. Pin
kutty balaji24-Jun-15 20:42
kutty balaji24-Jun-15 20:42 
AnswerRe: Winform MDI child form render not properly. Pin
Dave Kreskowiak25-Jun-15 3:42
mveDave Kreskowiak25-Jun-15 3:42 
QuestionOwn Mail Server with own domain Pin
abhijit.mdccb24-Jun-15 20:20
abhijit.mdccb24-Jun-15 20:20 
AnswerRe: Own Mail Server with own domain Pin
Richard MacCutchan24-Jun-15 22:15
mveRichard MacCutchan24-Jun-15 22:15 
QuestionSaving stream as a PDF file to disk Pin
Member 1171394224-Jun-15 12:17
Member 1171394224-Jun-15 12:17 
AnswerRe: Saving stream as a PDF file to disk PinPopular
Sascha Lefèvre24-Jun-15 13:53
professionalSascha Lefèvre24-Jun-15 13:53 
GeneralRe: Saving stream as a PDF file to disk Pin
Member 1171394227-Jun-15 0:38
Member 1171394227-Jun-15 0:38 
QuestionHelp with Windows Form and IF statement Pin
Member 1147010024-Jun-15 9:04
Member 1147010024-Jun-15 9:04 
Working around a puzzle slider game, using picturebox and tag properties. After the form has reshuffled the images, I set a function void IsWin()  using if statement to check the arrangement upon completion and display an output. but after arranging the scrabbled images the message box in the if statement doesn't pop up.

I will be glad if some anyone can help me identify what i am doing wrong. Thank you


Code for the shuffled images


C#
private void Form1_Load(object sender, EventArgs e)
        {
            
            /////////////////////
            Image p1 = pic1.Image;
            string tag1 = pic1.Tag.ToString();
            pic1.Tag = pic8.Tag;
            pic8.Tag = tag1;
            pic1.Tag = pic8.Tag;
            pic1.Image = pic8.Image;
            pic8.Image = p1;

            Image p2 = pic4.Image;
            string tag2 = pic4.Tag.ToString();
            pic4.Tag = pic12.Tag;
            pic12.Tag = tag2;
            pic4.Image = pic12.Image;
            pic12.Image = p2;

            Image p3 = pic3.Image;
            string tag3 = pic3.Tag.ToString();
            pic3.Tag = pic10.Tag;
            pic10.Tag = tag3;
            pic3.Image = pic10.Image;
            pic10.Image = p3;


            Image p4 = pic2.Image;
            string tag4 = pic2.Tag.ToString();
            pic2.Tag = pic11.Tag;
            pic11.Tag = tag4;
            pic2.Image = pic11.Image;
            pic11.Image = p4;


            Image p5 = pic5.Image;
            string tag5 = pic5.Tag.ToString();
            pic5.Tag = pic13.Tag;
            pic13.Tag = tag5;
            pic5.Image = pic13.Image;
            pic13.Image = p5;

            Image p6 = pic6.Image;
            string tag6 = pic6.Tag.ToString();
            pic6.Tag = pic14.Tag;
            pic14.Tag = tag6;
            pic6.Image = pic14.Image;
            pic14.Image = p6;

            Image p7 = pic7.Image;
            string tag7 = pic7.Tag.ToString();
            pic7.Tag = pic16.Tag;
            pic16.Tag = tag7;
            pic7.Image = pic16.Image;
            pic16.Image = p7;

        }


code for the function Void IsWin()


C#
public void IsWin()
{

    if ((string)pic1.Tag == "1" && (string)pic2.Tag == "2" &&
       (string)pic3.Tag == "3" && (string)pic4.Tag == "4" &&
       (string)pic5.Tag == "5" && (string)pic6.Tag == "6" &&
        (string)pic7.Tag == "7" && (string)pic8.Tag == "8" &&
        ((string)pic9.Tag == "9" && (string)pic10.Tag == "10" &&
       (string)pic11.Tag == "11" && (string)pic12.Tag == "12" &&
       (string)pic14.Tag == "14" && (string)pic13.Tag == "13" &&
        (string)pic15.Tag == "15" && (string)pic16.Tag == "Blank"))
    {
        MessageBox.Show("You Win with " +move+" Moves.");
        won.Play();
        this.Close();
    }
}

GeneralRe: Help with Windows Form and IF statement Pin
Sascha Lefèvre24-Jun-15 9:41
professionalSascha Lefèvre24-Jun-15 9:41 
GeneralRe: Help with Windows Form and IF statement Pin
Member 1147010024-Jun-15 11:19
Member 1147010024-Jun-15 11:19 
GeneralRe: Help with Windows Form and IF statement Pin
Sascha Lefèvre24-Jun-15 12:03
professionalSascha Lefèvre24-Jun-15 12:03 
QuestionStore one value from rows of data in a table Pin
Rajesh_198024-Jun-15 8:37
Rajesh_198024-Jun-15 8:37 
SuggestionRe: Store one value from rows of data in a table Pin
Richard Deeming24-Jun-15 8:51
mveRichard Deeming24-Jun-15 8:51 
GeneralRe: Store one value from rows of data in a table Pin
Rajesh_198025-Jun-15 4:15
Rajesh_198025-Jun-15 4:15 
QuestionCan we overload an abstract method of an abstract class? Pin
NJdotnetdev24-Jun-15 7:20
NJdotnetdev24-Jun-15 7:20 
AnswerRe: Can we overload an abstract method of an abstract class? Pin
Richard Deeming24-Jun-15 7:40
mveRichard Deeming24-Jun-15 7:40 
GeneralRe: Can we overload an abstract method of an abstract class? Pin
NJdotnetdev24-Jun-15 7:52
NJdotnetdev24-Jun-15 7:52 
AnswerRe: Can we overload an abstract method of an abstract class? Pin
maddymaddy1425-Jun-15 19:37
maddymaddy1425-Jun-15 19:37 
QuestionAn abstract singleton factory Pin
Marco Bertschi24-Jun-15 1:48
protectorMarco Bertschi24-Jun-15 1:48 
AnswerRe: An abstract singleton factory Pin
Eddy Vluggen24-Jun-15 2:35
professionalEddy Vluggen24-Jun-15 2:35 
GeneralRe: An abstract singleton factory Pin
Marco Bertschi24-Jun-15 2:48
protectorMarco Bertschi24-Jun-15 2:48 
GeneralRe: An abstract singleton factory Pin
Eddy Vluggen24-Jun-15 8:21
professionalEddy Vluggen24-Jun-15 8:21 
AnswerRe: An abstract singleton factory Pin
Richard Deeming24-Jun-15 4:29
mveRichard Deeming24-Jun-15 4:29 
AnswerRe: An abstract singleton factory Pin
Dave Kreskowiak24-Jun-15 5:17
mveDave Kreskowiak24-Jun-15 5:17 
QuestionExtension Methods in .NET 2 Pin
Member 1171394223-Jun-15 20:43
Member 1171394223-Jun-15 20:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.