|
Hi Yomam,
U can try locking the textbox after displaying the value.
Success is not a Destination,
... But a Journey !!
|
|
|
|
|
Hello everyone. I am trying to create a simple sudoku generator.
I have decided to use textfields.
so far i have made the generation code but what i get stuck on is how to get spaces (blanks) and how to get the solution matrix so that the numbers cant be the same in horizontal and vertical rows and the 3x3 boxes.
i am using really simple code because i am still leaning the program but i am making this as a school project
i would be really glad if i got some help in this
~Solid Snake~
|
|
|
|
|
Use arrays to manipulate matrix.
|
|
|
|
|
please mail a more detailed explenation of how to set up arrays and other useful tips
|
|
|
|
|
google is a good choice here. In fact, if you need to know how to create an array, you really should be buying a book.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
well i actually have a beginners book that wont give me that kind of info
|
|
|
|
|
*grin* then you need a better book. msdn.microsoft.com is also full of info.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Creating a Sudoku generator is OK, and it is a great thing, but do not try to solve them by using computers, use your brain.
Chatura from Pearl of the Indian Ocean.
|
|
|
|
|
i dislike solving programs and i solve sudokus by hand frequently.
|
|
|
|
|
|
I actually find the challenge of designing algorithms to solve such puzzles is much greater than doing it by hand, especially if you apply AI concepts and use tools such as Prolog.
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
I've made a small code for free drawing in a pictureBox. With that, i can draw when i click-n-hold left mouse-button, release the mouse and draw anothers (without myPenWidth). But if i define myPen with the myPenWidth(if no, it's always 1 by default), there always a error "OutOfMemory" to be made when "i release my first mousedown and mousemove, and mousedown again".
Why's it happens??
This is my code:
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown<br />
If e.Button = MouseButtons.Left Then<br />
mousePath.StartFigure()<br />
End If<br />
End Sub<br />
<br />
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove<br />
If e.Button = MouseButtons.Left Then<br />
PictureBox1.Image = myImg<br />
Dim g As Graphics = Graphics.FromImage(PictureBox1.Image)<br />
Dim myPen As Pen = New Pen(Color.Blue, myPenWidth) <br />
mousePath.AddLine(e.X, e.Y, e.X, e.Y)<br />
g.DrawPath(myPen, mousePath)<br />
End If<br />
<br />
End Sub
|
|
|
|
|
You're not Diposing your Pen and Graphics objects after you're done using them in your MouseMove event handler. If you skip this step, you'll quite easily run the system out of GDI resources and/or system handles, causing the "Out of Memory" Exception.
.
.
.
Dim g As Graphics = Graphics.FromImage(PictureBox1.Image)
Dim myPen As Pen = New Pen(Color.Blue, myPenWidth)
mousePath.AddLine(e.X, e.Y, e.X, e.Y)
g.DrawPath(myPen, mousePath)
myPen.Dispose()
g.Dispose()
.
.
But, since you'll using this method constantly, you might want to put creating/destroying the Pen objject outside the MouseMove handler. This way you won't be creating a new pen every time the mouse moves at least one pixel!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i've modified it following your way, but it still OutOfMemory...
hix, how can i do this?
Any more help??
|
|
|
|
|
You can use mousePath.AddEllipse instead of mousePath.AddLine
Private mousePath As New System.Drawing.Drawing2D.GraphicsPath<br />
Dim myPenWidth As Integer = 12<br />
<br />
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown<br />
If e.Button = Windows.Forms.MouseButtons.Left Then<br />
mousePath.StartFigure()<br />
End If<br />
End Sub<br />
<br />
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove<br />
If e.Button = Windows.Forms.MouseButtons.Left Then<br />
Dim g As Graphics = Graphics.FromImage(PictureBox1.Image)<br />
Dim myPen As Pen = New Pen(Color.Blue, myPenWidth)<br />
PictureBox1.Image = myImage<br />
mousePath.AddEllipse(e.X, e.Y, myPenWidth, myPenWidth)<br />
g.DrawPath(myPen, mousePath)<br />
End If<br />
End Sub
Chatura from Pearl of the Indian Ocean.
|
|
|
|
|
You only need to start the figure the first time it is clicked as it is already started after this
This will remove the out of memory error but make it so that the next drawn line joins to the last one automatically which you'll have to look at
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
If e.Button = MouseButtons.Left Then
If MousePath.PointCount = 0 Then
MousePath.StartFigure()
End If
End If
End Sub
"If i was king cigarettes would be free."
|
|
|
|
|
Thanks!!
|
|
|
|
|
I need to have a user select an item from a combo box and I need to use that text. I have tried combobox.selecteditem, .selectedvalue, .selectedtext and none of these seem to work. Please help. Thanks in advance.
Also, the text originally comes from a database.
|
|
|
|
|
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged<br />
Dim myText As String<br />
myText = ComboBox1.SelectedItem.ToString<br />
End Sub
Chatura from Pearl of the Indian Ocean.
|
|
|
|
|
Hi Friend,
Sorry I don't know ur name.
First of all I would like to know which database u r using and whether u r retrieving data from the database or inserting the data into the database.
If u r firing a SQL query then I think this will b helpful to u :
strsql = "SELECT * FROM Emp WHERE Emp_Name='" & Combo1 & "'"
This query displays all the records from the table named 'Emp' according to the list item selected from the combobox named 'combo1'. 'strsql' is a string holding the query.
Success is not a Destination,
... But a Journey !!
|
|
|
|
|
mcqRecordset.Open "select * From MultipleChoice, MultipleChoiceAnswer,Level Where MultipleChoice.multipleChoiceID=MultipleChoiceAnswer.multipleChoiceID AND MultipleChoice.levelID=Level.levelID", myConnection, adOpenStatic, adLockOptimistic
Error: error in from clause
plz help me
Thx again
Arshaad
|
|
|
|
|
Keep it in the same thread!
---
b { font-weight: normal; }
|
|
|
|
|
Try restructuring the query...
select * From MultipleChoice AS MC<br />
JOIN MultipleChoiceAnswer AS MCA ON MC.multipleChoiceID = MCA.multipleChoiceID<br />
JOIN Level AS L<br />
ON MC.levelID = L.levelID<br />
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
hello there, any help in the following:
For sure u tried to change the skin of windows media player,when u choose the skin the interface(form) take the shape of a certain picture,not the square shape of the ordinary form, example the radiohead skin.
Any help using VB.NET and ill be very very thanksfull
|
|
|
|
|
Set FormBorderStyle property to None
Set the BackgroundImage property to the image you want to use
Now set the TransparencyKey property to the background color of the image.
Run you app
Note: When I tried to do this by using VB.Net 2003 it didn?t work. Solution to this problem is reseting the screen to use color values that are 24 bits or less. In Vb.Net 2005, it works fine.
If the background color of the image appears in your image too, you can see holes in your image, therefore, do not use a common color as the background color of the image.
Chatura from Pearl of the Indian Ocean.
|
|
|
|