|
campbells wrote: my friend r telling me i have less ram cause low memory problem.
Entirely possible, but this has nothing to do with your problem. Actually, the way your doing it now uses more memory than doing it properly, but it's only by maybe 1-2K Bytes...
campbells wrote: i still want to find other solution cause i still havent figure out how the xml u told me
I practically wrote the bloody thing for you. Your biggest problem is how you represent data inside your application.
campbells wrote: now i want to retrieve all the information
How you wrote the file in the first place is what's making it such a pain in the a$$ to read it back in!!!
campbells wrote: and i'm not sotring the data in the TEXTBOX because when exit the system everything sure will gone
You don't have a single clue about what you're doing, do you?? I highly suggest picking up a beginners book on VB.NET. Save yourself 3 more months of beating your head against a wall getting this to work. Learn to do it the correct way from the start. Right now, you've got much bigger problems than just how to read a text file...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i dunno is it i make it hard to read or not, casue my concept is that when i able to write it then just read in line by line. cause i know wats the line going to be. i know the first line going to repsent wat data so i make it as read the second line as playername.text , which i bring the information into the box. Maybe the way i think is simple , casue normally we refer the
playerEnterName.text= Playername.text
so i do the same way, casue the maximum data i need to save is only 4 player.
maybe i think it in toooo simple way which the computer might too hard to udnerstand then.
And i only have short 1 day left to finish it..unable to take 3 month to do it...
|
|
|
|
|
campbells wrote: Maybe the way i think is simple
If it was so simple, why are you here asking how to make it work?
campbells wrote: And i only have short 1 day left to finish it..unable to take 3 month to do it...
Done correctly, you could have done it in 3 minutes. But, ahh, the truth finally comes out. This is homework, isn't it?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
campbells wrote: cause i know wats the line going to be
No, you code EXPECTS the first line to represent a certain value. It does not, and cannot, KNOW the the first line is exactly whe you expect it to be. If there is a single mistake or an extra linefeed in the file, your code will, at worst crash, and at best load the wrong data in the wrong fields, because it's totally intolerant of any mistakes in the data file. Do you absolutely KNOW that no-one will edit the data file?? No, you don't, and you can't possibly stop it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ohh~ i solve the problem!! is nothing wrong with my code but is my label set to visible false when my form load so i cant see anything hahahah :P
is not homework is my project i doing a game system only left the save and load function wuu now done.. Thanks for u time anyway , i think the xml things will good for my future when i work since lot of projec use that..will learn that after my school...
|
|
|
|
|
Hello!
I've got a small problem with textboxes..
There are 4 text boxes on my form.
When the program has started the cursor always blinks in one of the four textboxes.
But I want the textboxes to display a value (at first) and not to enter one.
How can I prevent the blinking cursor to be set to a textbox??
Thanks in advance..
|
|
|
|
|
Textboxes are meant for the input of text data and the active one will always show a cursor.
If you don't want this and the user does not need to input any text then change the TextBox controls to Labels.
If the user must enter text at some stage then you can move the focus to another (non-TextBox) control - but the user could still move the focus back to a textbox and the cursor will reappear.
...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
-- modified at 22:03 Sunday 26th March, 2006
-- spell checked
|
|
|
|
|
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.
|
|
|
|