(I'll make this sweat and short, writting in class)

Okay so I am working on a sudoku program, and am using a dataGridView for the gameboard. But I need to know how to create different boarders for the cells so that I can make up the 4 black lines that seperate the the 81 squares into 9 seperate 9x9 clusters, but I have no clue how to do this. I created the columns for the gameboard threw the form builder and the rows with

for (int i = 0; i < 9; i++) //adds the rows to dataGridView

So how would I create these borers (hopefully this makes sense again I am rushing this, professor is getting suspecious of my activities right now)

Recommended Answers

All 5 Replies

I should not use DataGridView here.
Think more of a Panel on which you draw a 9x9 grid in any size, shape, thikness and color you want.

The problem is that using a dataGridview it's one item and can be refenced extremely easily. We have to program it so certain keys function with it, so the arrow keys move, tab moves, ext. I mean I can see that possible with panels but it seems to me that would be alot of extra programming. Plus I am using a 2d array as it is for data, so that works great when working with a dataGridView. Now maybe I am wrong and if I am can then help me address these issues (it must be efficent though).

I am not doubting you, I thought of panels but these were the reasons I hesitated to use them (plus i have to have a contextMenuStrip for the board, and a textBox that references with it)

You could try using the DividerWidth on the specific columns as it pads the right side of the column. Same property on the rows might get you something close to what you want. You'll have to get the column/row collection from the DataGridView and figure out which ones you want to change the property on.

Well that did work for my problem I had to do some resizing but this should do the trick fine (need to do some more tests but for now, alrgiht).

as for ddanebe I kind of still would like to hear back from you

Well, a sudoku was one of my first projects I did in C#!!
I did it the way I said, by just drawing on a panel, I even moved a coloured rectangle with the arrow keys. It just couldn't solve, for the rest all was there.
I lost the project when changing to a new computer. :'(
That was before I even new about DataGridView, but it was fun to program.

Be a part of the DaniWeb community

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