|
I have notice a problem where the system only read the first line, only the first line was read and pass to the system but it pass to the last line of my code which is
game.PTurn.Text = strmw.ReadLine()
the whole coding for like this
If num = "1" Then
game.Pname1.Text = strmw.ReadLine()
game.PP1.Text = strmw.ReadLine()
game.counter1.Text = strmw.ReadLine()
game.PTurn.Text = strmw.ReadLine()
|
|
|
|
|
lol you have compicated it isnt it battter that u use "For" and "Next"?
or "Substring"?
<blink>FeRtoll Software.net
------------
E-Mail me
WebPage
|
|
|
|
|
then use substring in timer with interval (1) .... its fast :->
<blink>FeRtoll Software.net
------------
E-Mail me
WebPage
|
|
|
|
|
it will even worse cause the problem is with the hardware memory
|
|
|
|
|
If you had a hardware problem with the memory, your code, not to mention Windows wouldn't even run. Ever hear of the Blue Screen of Death?? That's what you get when you have hardware RAM problems...
Look, your code is a total mess and now your making up reasons, that you don't understand yourself, for why your doing it the hard way.
I showed you how to store player information in an array of class objects and how to serialize that array out to an XML file and read it back in. The biggest problem you have right now is that you don't understand how to represent and store your games data properly. Storing your games data in a bunch of TextBoxes is NOT the way to do it. The user interface you put on that form should only be used to display the current game state that you have stored. The controls, and the code behind them, should be used to tell your game how to manipulate the game state. The should NOT be used to store the actual data!!!
By NOT storing your game's data in a well thought-out structure, that has no dependancy on user controls what-so-ever, your actually making the rest of the game 100 times harder to write, and more importantly, 100 times harder to support!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
oh is it i dunno that my friend r telling me i have less ram cause low memory problem.
y i still want to find other solution cause i still havent figure out how the xml u told me.
ACtually i had already to store the data in the text file which when i check the file it was in there, and now i want to retrieve all the information and show it on the textbox, and i'm not sotring the data in the TEXTBOX because when exit the system everything sure will gone.
|
|
|
|
|
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
|
|
|
|