Hi,
I'm new in this forum :D
I've started learning C# @ school 1 year ago , and i love it,and it's going very well, now We had 2 lessons of Windows applications in C#, and to be honest i find it much harder than console application.
now we have to do a project:
getting a sudoko from a user,checking if it's faulty and than paint the the row\col\square if it has problems.
now writing this in C# console app is peace of cake, but im having troubles with the windows app.
First my UI will be 9 buttons at the bottom which contain numbers between 1-9,and the table of sudoko above it,and to make the buttons as drug n' drop to the table.
These are the things I just don't know how to do,i think i can handle anything else,my problem with the buttons is that i will have to work with each one of them, isn't there a way to make them in an array and than work with it as if it was an array?
how do i make a table that can get numbers(by drag n' drop) and how do i make drag n' drop?
Is there a good guide on the internet for WinAPP?

Thank you very much in advance!
, JooClop

have you tried the "Allow Drop" property of the control you want?
I think it is what are you looking for...
to be honest, I have never used this property and I don't know how to work with it :P

Never heard about it,i guess i should check how to work with it, at least i got the name thanks :D
could you help me with the button array?

Here is one way to handle an array of buttons :

//Create array of 10 buttons numbered 0 to 9.
            Button[] myArrayOfBtn = new Button[10];
            //Now init the buttons
            for (int i = 0; i < 10; i++)
            {
                myArrayOfBtn[i] = new Button();
            }

I don't think you really need to have an array of buttons for this project.
Instead set the table to allow drop that way it will allow you to use the drag drop events on the table.
Then on the Mouse Move event of the buttons, start a drag operation. Let the table handle the drag events, and handle the button that is being dropped on the table.

There are plenty of examples of drag drop on the net, and you should be able to see how to do each of these functions, however if you get in over your head, there are folks here that can help.

// Jerry

hi,
foa, thank you very much!
this is what i wrote now in Console app(this is basically what the teacher asked):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication132
{
    class Program
    {
        public static bool isvalid(int []ar)
        {   
            for (int i=0;i<9;i++)
            {for (int j=0;j<9;j++)
                if ((j!=i)&&(ar[i]==ar[j]))
                    return false;
            }return true;
        }

        public static bool row(int [,]mat,int rownum)
        {
            int [] ar=new int [9];
            for (int j=0;j<mat.GetLength(1);j++)
                ar[j]=mat[rownum,j];
            if (isvalid(ar))
                return true;
            return false;

        }

  public static bool col(int [,]mat,int colnum)

  {     int [] ar=new int [9];
            for (int i=0;i<mat.GetLength(1);i++)
                ar[i]=mat[i,colnum];
            if (isvalid(ar))
                return true;
            return false;

        }
  public static bool square(int [,]mat,int rownum,int colnum)
        {
          int [] ar=new int [9];
               int k=0;
            for (int i=0;i<3;i++)
            {   for (int j=0;j<3;j++)
                {  ar[k]=mat[rownum+i,colnum+j];
                   k++;
                }
           }
      if (isvalid(ar))
          return true;
      return false;

          }
  public static int[,] insert()
  {
      int num;
      int[,] mat = new int[9, 9];
      for (int i = 0; i < 9; i++)
      {
          for (int j = 0; j < 9; j++)
          {
              Console.WriteLine("Please Enter a number dude");
              num = int.Parse(Console.ReadLine());
              while (num < 1 || num > 9)
              {
                  Console.WriteLine("Woot cant do that!Enter again");
                  num = int.Parse(Console.ReadLine());
              }
              mat[i, j] = num;
          }
      }
      return mat;
  }
  
        public static void printrows(int [,] mat)
        {
            for (int i = 0; i < 9; i++)
                if (row(mat, i)==false)
                    Console.WriteLine("|Row {0} is Faulty!|", i+1);
        }

        public static void printcols(int[,] mat)
        {
            
                for (int j = 0; j < 9; j++)
                    if (col(mat, j)==false)
                        Console.WriteLine("|Column {0} is Faulty!|", j+1);
            

        }

        public static void printsquares(int [,] mat)
        {
            int k = 0;
            
                for (int i = 0; i < 9; i=i+3)
                { for (int j = 0; j < 9; j=j+3)
                {
                    k++;
                    if (square(mat, i,j)==false)
                        Console.WriteLine("|Square {0} is Faulty!|", k);
                }
                }
        }
        static void Main(string[] args)
        {
            int[,] mat;
            mat = insert();
            printrows(mat);
            printcols(mat);
            printsquares(mat);
            Console.ReadLine();
        }
    }
}

and it works like a charm,
now what is left is to "convert" it to windows app, atleast i got 50% of the job done , so i really need your help, i just realized that i dont know nothing about windows app, i dont know where even 2 put the command lines you've wrote, should i use a method for that? can i make my own method in the form? a link for a guide would be very appreciated :) so i can read up and than ask questions :P
Thank you all for your help!
P.S
jerry, just saw ur msg,thank you for your advices, maybe i should not do array of buttons... I'll search now the web for drag n drop in winapp.
thanks :)

another thing, how can i make a table to get all the numbers(lets say 9 boxes of numbers which ill use as drug n drop to the table) and than transfer it to a matrix?

I would imagine that you can even find some example Sudoko (or similar games) code on Code Project or elsewhere on the net.

huh well, that will be called cheating :D and besides i've done it in console app as i been told only to check the soduko and to generate and solve one :D so this was peace of cake,I'd like to see examples of windows apps, and i cant find some :|
isn't there a site that explains every command? :S
and basically our level is low, its high school...i dont even know what is class,and only next year we will start learning recursion

Good, I am glad you have decided not to cheat.
On the otherhand, reviewing someones code is the way most everyone learns.
Okay, as for the buttons, I assume you are using Visual Studio 2008 Express, if not get an IDE, SharpDev, Mono or VS2008e (all are free).

Here is some code to get you started:
Create a Windows application, and spread out the form so it can fit the 9 buttons along the bottom of the form.

For now, I dragged a Label component from the toolbox onto the center of the screen. This is the component we will drop the buttons onto. You will want to use your own target component(s) once you understand the concept. Set the AllowDrop property in the property editor of the label to true (means yes, I want this component to allow things to be dropped on it).

Select the first button (button1 in this case), and in the property editor, select the event (lightening bolt) tab, and find the onMouseMove event handler. Type in buttonMouseMove (or whatever you desire). Press enter and let it create the event handler code. Now go back to the form and select all of the other buttons, and drop down the onMouseMove property combobox, and select the buttonMouseMove handler you just created. This ties all of the buttons to the same event handler (just makes it easier than creating and duplicating 9 handlers).

Next you want to force the button into a Drag operation by using the button's DoDragDrop method. Now you have a button in the drag-able mode, lets deal with the label (the target for the drop operation).
As a minimum, you want to set the DragOver event handler of the label (target) so the user and component will know it is okay to drop the dragged object here. You will set the event handler for the DragOver of the lable to provide a drag effect which will change the cursor as the object is dragged over it.

Finally you want to assign an event handler to the DragDrop handler of the label to accept the dragged object.

In the handler you will get the object that has been dropped. We know this is a button for this little example, so I do not perform the typical checking and validation, but rather I just cast the incoming object as a Button, and set the Label's text to be the same as the dropped button.

Hope this helps,
// Jerry

using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void buttonMouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Button btn = sender as Button;
                btn.DoDragDrop(sender, DragDropEffects.Copy);
            }
        }

        private void label1_DragOver(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.Copy;
        }

        private void label1_DragDrop(object sender, DragEventArgs e)
        {
            Button btn = e.Data.GetData(typeof(Button)) as Button;
            label1.Text = btn.Text;
        }
    }
}

amazing! very detailed explanation!!! I'm gonna try that immediately when i come back from school and report later! hands down.
thank you!

Hello Jerry!
I've tried the things you've (very easy to follow, you should be a teacher/professor! and i can't get this working, I'm attaching what I've done so far, which is basically what you told me to do (didnt add anything yet),maybe i missed something(in the image there are the form and parts from the form1.cs,form.designer.cs,properties and event handler)
and when i activate it(F5) i can't drag anything to the label, and by they way, will i have to make 81 labels for the soduko?!
And i really appreciate your help!
Thank you very much,
JooClops
P.S
damn resolution is higher than allowed
so here is the link:
[img=http://img237.imageshack.us/img237/1417/winapp.jpg]

ok never mind that! i found my mistake(forgot the label 1 drag drop in the event handler)
now how can i make 81 labels????than i'll try to continue by my own
thank you so much,
JooClops

The Label was purely to help you experience and play with Drag & Drop (concept stuff).
Not being a Sudoko player myself, I am not all that familiar with the game board.
If I were building it, I would use graphical design methods, but those are (for now) a bit more advanced than you should tackle.

To generate 81 labels, you can create and add them at runtime within a loop. You need to perform a few steps for this.
Primarily you will create them in a for..loop, and add them to the Main form, or a panel (or some other container).

Here is a quick and dirty way, you will have to manage your own location and size values:

To add this to your code, select the form, and assign an event handler for the Load event. In the code snipet below, I just create 4 new labels, and position them on the form, add them to the container (in this case the form itself).
Assign the event handler like you did in the Label component as you did earlier.

private void Form1_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 4; i++)
            {
                Label lbl = new Label();
                lbl.Text = i.ToString();
                lbl.Location = new Point( 30, 70 + (i * 20) );
                lbl.Size = new Size(label1.Width, label1.Height);
                lbl.DragDrop += label1_DragDrop;
                lbl.DragOver += label1_DragOver;
                lbl.AllowDrop = true;
                this.Controls.Add(lbl);
            }
        }

This being done, now you need to change the DragDrop event handler because it will be used by multiple components.

private void label1_DragDrop(object sender, DragEventArgs e)
        {
            Label target = sender as Label;
            Button btn = e.Data.GetData(typeof(Button)) as Button;
            target.Text = btn.Text;
        }

All we did was cast the sender to Label, and set its text from the dropped button.

Have Fun!
//Jerry

Hey , Thanks a lot again.
I think i understood some of the concepts now, ill work on it now for 2 days, and post some minor question here and there,And i'll post back what i've done in these days(i have busy week :P i need to get ready for the second stage of the physics Olympiad here).
The part i afraid the most is getting the values from the label to a 9*9 matrix(soduku) and maintaining the order of the labels in the form.
ok,so i'll post back soon.
Thank you very much for your help,
JooClops

P.S for making it look like a table of soduku ill have to do another for loop in the for loop right?
done ! :D now i shall continue

another thing i encountered , i've made the 9*9 labels to drag to, but i made a table of 9*9 as well , but when i press F5 it hides the labels , i mean,it;s like the table is upon the labels, and i dont want that, i just want visual table (without coding or something) and the labels inside(coded separately) so is there a way to make the table behind the label? i can't find it in the properties of the table...but it should be there...

Which "table" component are you using ?
Is this a DataGridView ? ListBox ? or something else ?

// Jerry

Table-Layout-Panel :)

Jooclops
Edit:
one more thing:
why can;t I change the size of the labels? not even in the properties of the label... I\ll make a screen shot later :D
thanks for your help!

The container should be the table (panel) not "this".
So instead of creating the labels and adding them to this

this.Controls.Add(lbl);

use

panel1.Controls.Add(lbl);

// Jerry

commented: Nice job! +4

Wow great ! thank you!
now it looks like a soduko(more or less) :}
ok now I'll try to implant my program from console app to this.
I'll report if i encounter problems.
Thank you so much ,really!
JooClops
EDIT:
Can i get the information from the labels as numbers? i need to gather them to a matrix.. but they are strings XD
and i want to get the infromation from the label when it changes, so i need to make an event handler that if lbl.text.change==true mat[i,j]=lbl.text?

Looks like you are making progress.

You can create a single event handler for the label object to do this, however you could just as easily tag the event into the Drag Drop onto the label.

If you want to allow the user to actually type values into the object, you should replace the label component(s) with a TextBox component.

To turn a string from the label or TextBox (any string) into an integer you can use the parsing methods of that type.

int i;
            string someValue = "123";
            if (Int32.TryParse(someValue, out i))
            {
                // i now = 123
            }
            else
                MessageBox.Show("Invalid value, must be numeric");

To control the size of your labels, you should set the AutoSize property to false.

// Jerry

Looks like you are making progress.

You can create a single event handler for the label object to do this, however you could just as easily tag the event into the Drag Drop onto the label.

If you want to allow the user to actually type values into the object, you should replace the label component(s) with a TextBox component.

To turn a string from the label or TextBox (any string) into an integer you can use the parsing methods of that type.

int i;
            string someValue = "123";
            if (Int32.TryParse(someValue, out i))
            {
                // i now = 123
            }
            else
                MessageBox.Show("Invalid value, must be numeric");

To control the size of your labels, you should set the AutoSize property to false.

// Jerry

Hi again,
first of all i cant stop telling you how much i appreciate your help, I've started this from almost 0% knowledge on winApp, basically I know some basic stuff and that's all, your really a life saver.
now OnTopic:
"If you want to allow the user to actually type values into the object, you should replace the label component(s) with a TextBox component."
There are 2 reasons why this is not an option for me:
1.Every box in the soduku table should hold a number between 1 to 9,so if i'll make it as a textbox, I'll have to do more "input checks"...
2.Drag n' Drop sounds cooler, and as far as i knows in the past years nobody done that in our school,so it is more special than normal text box.

I had no luck succeeding to convert to integer with the method you wrote... don't know why, i must be really noob :D
but i searched on the web and i found the convert to int method,
so this is the code i have so far:

private void Form1_Load(object sender, EventArgs e)
        {
            int[,] mat = new int[9, 9];
            for (int i = 0; i < 9; i++)
            {
                for (int j = 0; j < 9; j++)
                {
                    Label lbl = new Label();
                    lbl.Text = (i + 1).ToString();
                    mat[i,j] = Convert.ToInt32(lbl.Text);
                    lbl.Location = new Point(120 + (j * 100), 70 + (i * 40));
                    lbl.Size = new Size(label1.Width, label1.Height);
                    lbl.DragDrop += label1_DragDrop;
                    lbl.DragOver += label1_DragOver;
                    lbl.AllowDrop = true;
                    panel.Controls.Add(lbl);
                }
            }

and the matrix gets the numbers as it should :D(checked it).
I've also attached a picture of how the form looks like,the drag n' drop is easy cause i made the size of the label fit exactly to the table's box size(done the autosize=false as you've said!).

Now some problems i thought of:
1.once the label is changed ,how can i change it in tthe Matrix , i need to get it's place,which i can't think of a way to do it :\
2.in a later stage when i'll have to make buttons for "sumbit to check" and "clear", if the "submit" is pressed i'll have to make an event handler,and than we can say i'll just need to rewrite my program from console app to the method,will i be able to send the matrix there?

Thank You,and sorry for my noob questions :)
JooClops

can't attach it, so here is a link [img=http://img207.imageshack.us/img207/6326/34666300.jpg]

Okay,

No problem on the newB questions, everyone is a NewB at some point.

Does not look like you need to convert the text to integer, the (i+1) that you are assigning to the Text, is already an integer, so just set the array value to that value: mat[i,j] = i +1;

"1.once the label is changed ,how can i change it in tthe Matrix , i need to get it's place,which i can't think of a way to do it :"
For this, I will show you another little trick called Tag.
All components (well 99% of them) have a Tag property of type object. You can store anything you want in there. For this (and to keep it simple) lets place the address in this property as a string:

lbl.Tag = string.Format("{0}|{1}",i,j);
// use of the pipe character as a delimiter is just my choice, you can use any charcter.

Now to use this you will need to split the address back out and convert them back to Integer.

private void label1_DragDrop(object sender, DragEventArgs e)
        {
            Label target = sender as Label;
            Button btn = e.Data.GetData(typeof(Button)) as Button;
            target.Text = btn.Text;
            string address = (string)target.Tag;
            int i = Convert.Int32(address.Split('|')[0]);
            int j = Convert.Int32(address.Split('|')[1]);
            mat[i,j] = Convert.Int32(target.Text);
        }

BTW: you will learn this later, but code formatting will help your code stand out. For example all class private variables should start with an underscore (if you wish to follow the Microsoft coding standards). Example: your mat array is a class declared private variable. To give it that professional touch you should name it _mat. This way as someone is looking at your code and see a variable that starts with an underscore, they will know it is a class based private variable. It is just a standards thing, and no one can force you to do it (unless you work where I do :)

// Jerry

commented: Great job :) Plenty of work you did!!! +2

Hello again Jerry,
Thank you for the tricks :> and advices(from now on i use underscore before a class private variable) I'm learning so many new things(and i like it!) :>

Now,
I want to make my matrix not private, so i can use it and change it in every function i want(I'll need to use it when checking it[On sumbit]) how can i do that? where do i declare this statement:
" int[,] _mat = new int[9, 9];"

private void label1_DragDrop(object sender, DragEventArgs e)
        {
            Label target = sender as Label;
            Button btn = e.Data.GetData(typeof(Button)) as Button;
            target.Text = btn.Text;
            string address = (string)target.Tag;
            int i = Convert.ToInt32(address.Split('|')[0]);
            int j = Convert.ToInt32(address.Split('|')[1]);
            _mat[i, j] = Convert.ToInt32(target.Text);
            
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            int[,] _mat = new int[9, 9];
            for (int i = 0; i < 9; i++)
            {
                for (int j = 0; j < 9; j++)
                {
                    Label lbl = new Label();
                    lbl.Text = (i + 1).ToString();
                    _mat[i,j] = i+1;
                    lbl.Location = new Point(120 + (j * 100), 70 + (i * 40));
                    lbl.Size = new Size(label1.Width, label1.Height);
                    lbl.DragDrop += label1_DragDrop;
                    lbl.DragOver += label1_DragOver;
                    lbl.AllowDrop = true;
                    lbl.Tag = string.Format("{0}|{1}", i, j);
                    panel.Controls.Add(lbl);
                }
            }

this is what i have so far(and it doesnt work cause the matrix is only declared in the form1_load function) maybe making it public instead of private will help... or not XD..
Thank You,
JooClops

You need to move the declaration to the top of the class.

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
      
       // Private class declarations
       [B]private int[,] _mat new int[9, 9];[/B]

        public Form1()
        {
            InitializeComponent();
        }
...

When declared inside the class but outside of any methods it is a class variable. Any method within the class can access it.
Use public variables when classes outside of this class need to have access to it. You do not have any of those yet.

Also something to know is that any method declared inside of a method is only accessable from within the method it is declared. Also, the instance will die the moment the method exits.

BTW, what country are you residing ? just curious as to the time difference. I am in Idaho USA

// Jerry

Hi,
I'm not from the US :< I currently live in Israel.
and im 16.5 years old :)

Now,
I've made two new buttons:
1."Check me".
2."Clear".

about the Clear:
Instead of thinking a lot and writing a lot, I will just make an event for it clicked and reload the form(if it's possible).

about the "Check me"
I thought this one will be the easiest... but It's not, I thought i should just copy my Console.app functions with minor changes and that's all, but nope...
Here is the code(Don't read anything, just the functions' topic)
I think the "main" function is what making a mess here.

private void button10_Click(object sender, EventArgs e)
        {         
public bool isvalid(int []ar)
        {   
            for (int i=0;i<9;i++)
            {for (int j=0;j<9;j++)
                if ((j!=i)&&(ar[i]==ar[j]))
                    return false;
            }return true;
        }

        public bool row(int [,]_mat,int rownum)
        {
            int [] ar=new int [9];
            for (int j=0;j<mat.GetLength(1);j++)
                ar[j]=_mat[rownum,j];
            if (isvalid(ar))
                return true;
            return false;

        }

  public bool col(int [,]_mat,int colnum)

  {     int [] ar=new int [9];
            for (int i=0;i<mat.GetLength(1);i++)
                ar[i]=_mat[i,colnum];
            if (isvalid(ar))
                return true;
            return false;

        }
  public bool square(int [,]_mat,int rownum,int colnum)
        {
          int [] ar=new int [9];
               int k=0;
            for (int i=0;i<3;i++)
            {   for (int j=0;j<3;j++)
                {  ar[k]=_mat[rownum+i,colnum+j];
                   k++;
                }
           }
      if (isvalid(ar))
          return true;
      return false;

          }
  
        public void printrows(int [,]_mat)
        {
            for (int i = 0; i < 9; i++)
                if (row(_mat, i)==false)
                    MessageBox.Show("|Row {0} is Faulty!|", i+1);
        }

        public void printcols(int[,]_mat)
        {
            
                for (int j = 0; j < 9; j++)
                    if (col(_mat, j)==false)
                        MessageBox.Show("|Column {0} is Faulty!|", j+1);
            

        }

        public void printsquares(int [,]_mat)
        {
            int k = 0;
            
                for (int i = 0; i < 9; i=i+3)
                { for (int j = 0; j < 9; j=j+3)
                {
                    k++;
                    if (square(_mat, i,j)==false)
                        MessageBox.Show("|Square {0} is Faulty!|", k);
                       }
                }
        }
     static void main(System[]args) 
     {
          
           printrows(_mat);
            printcols(_mat);
            printsquares(_mat);
     }


     }

Am I doing something wrong? well of course i do , but what :)?
BTW Don't mind the MessageBox.Show(....) It's temporary , I;ll make instead of it something that paints the col\row\square that is faulty to another color.

Thank You a lot ,Jerry!
I can't believe It's almost finished(or not)! So i can have my 2 week holidays free (free minus physics=3 days free :X)

JooClops

Your declaration of the Main function looks a bit strange.
For a Console application it is normally:

static void Main(string[] args)
        {
        }

For a Windows application we have normally:

[STAThread]
        static void Main()
        {
        }

You don't do much in the main function. You just start up to run the Application class with a Form.

JooClops,

Hope you live in a safe area of Israel.

It appears that you just copy paste'd the console methods into the Check button handler. That won't work.

You have three methods that are used to check faulty entries:
Col, Row, Square
and a single method used by each for the actual validation.
Rewrite them as individual methods (IOW not inside the Check button), and call them accordingly.

So, lets start with the isvalid method: Create it as its own method (not embedded within another method.)

private bool IsValid(int[] ar)
        {
            for (int i = 0; i < ar.Length; i++)
            {
                for (int j = 0; j < ar.Length; j++)
                    if ((j != i) && (ar[i] == ar[j]))
                        return false;
            } 
            return true;
        }

Changed to a private (non static) method using Camel-Case naming convention.
Modified to account for arrays less than 9 in length.

Next we need to add the row check method:

private bool CheckRow(int rownum)
        {
            int[] ar = new int[9];
            for (int j = 0; j < _mat.GetLength(1); j++)
                ar[j] = _mat[rownum, j];
            return IsValid(ar);
        }

Changed to a private (non static) method using a new Name.
Using the private _mat instead of passing it as a variable.
Return whatever IsValid gives you instead of evaluating it.

The remaining two methods are similar in changes:

private bool CheckCol(int colnum)
        {
            int[] ar = new int[9];
            for (int i = 0; i < _mat.GetLength(1); i++)
                ar[i] = _mat[i, colnum];
            return IsValid(ar);
        }

        private bool CheckSquare(int rownum, int colnum)
        {
            int[] ar = new int[9];
            int k = 0;
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    ar[k] = _mat[rownum + i, colnum + j];
                    k++;
                }
            }
            return IsValid(ar);
        }

Now for the actual Check button. I named the button btnCheck

private void btnCheck_Click(object sender, EventArgs e)
        {
            int k = 0;
            string faults = string.Empty;
            for (int i = 0; i < 9; i++)
            {
                if (!CheckRow(i))
                    faults += string.Format("Row: {0} is Faulty!\r\n", i);

                for (int j = 0; j < 9; j++)
                {
                    if (!CheckCol(j))
                    {
                        faults += string.Format("Col: {0} is Faulty!\r\n", i);
                        break;
                    }
                }
            }
            for (int i = 0; i < 9; i = i + 3)
            {
                for (int j = 0; j < 9; j = j + 3)
                {
                    k++;
                    if (!CheckSquare(i, j))
                        faults += string.Format("Square: {0} is Faulty!\r\n", k);
                }
            }
            if (!string.IsNullOrEmpty(faults))
                MessageBox.Show(faults, "Faults");
            else
                MessageBox.Show("Success");
        }

What we are doing here is populate a string with all of the discovered faults, and finally displaying the result in one dialog box.

You could get fancy here, and populate a List<string> private class variable, and kick off a timer to flash the labels back color with red for those faulty items. If you want to go down this path, let me know and I can help.

Since your program is growing, I suggest you send me the zipped project in a private message if you need additional help.

Have Fun!
Jerry

Wow,
Thank you so much! It's Almost like a real soduko!!!
:D and more important i actually understood everything,I learned so many new things, it's so great! i love programming XD

I'll zip it to show You how it looks in the minute ill figure out which parts ought I zip :P

now few more things are left for making it perfect:
I tried making the clrbtn_click function, now after I've done it I realized that it just clears the matrix, but not the labels on the screens...so instead of trying to work it out maybe there is a way to just reload the form?
second thing, the labels are sized perfectly but the TEXT size is small, I've reviews the propertied and didn't find anything...OK NVM FOUND IT XDD i just wrote

lbl.Font = new Font("verdana", 12, FontStyle.Bold)

now it looks awesome :)
so just the clear thing is left :>

I'm so happy,Can't tell You how grateful I am, and btw i live in non dangerous zone here,You should come visit :), so I'm safe , thank You for your concern.

JooClops
EDIT:
BTW My level of programming is not so high yet, It was our first year, and in school programming lessons are more logic based and almost zero skills, i mean , I barely know what I can do with "Classes" ,cause we'll only learn it next year, these are the things we will learn next year: Lists,recursion,Binary tree,Classes.
What I know is basic, and some things I've learned by my own, cause I was interested in solving problems from project euler ,and i made a few, but there were questions which u have to use Bignumber class , cause the numbers are HUGE!!! 9.6124123E+194
XD
thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.