Jump to content
  • Advertisement

Darkneon

Member
  • Content Count

    97
  • Joined

  • Last visited

Community Reputation

166 Neutral

About Darkneon

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi Eldritch, I can't help you with TODAYLISTITEM, looks like a Win32 structure that you will need to recreate in .NET. HWND - IntPtr HRESULT - Int
  2. Hi Guys, I know this is a stupid question to ask because I can test it myself and see the results by myself. The thing is I don't have Sql Server at home so here it goes. Situation: I have a loop that continually access a database every 60 seconds. Which approach is more effecient in terms of memory managment. 1. Create the SqlConnection object once and every minute open the connection and then close it? or 2. Every minute create the SqlConnection object, open the connection, close the connection, and dispose of the object? Thanks Darkneon
  3. Darkneon

    Homeland Security Official Arrested

    Quote:Original post by Fruny In other news. [wow][wow][wow] This actually made me laugh, but in a sad sad sad way. Quote: "My son had something shoved up his butt seven or eight times. If that's not sexual assault, what is?" Prosecutor James Landis told a judge at last week's hearing that the "broomsticking" was a hazing ritual and a punishment, not sexual assault. The plea agreement describes the assault charge as "a non-dangerous, non-repetitive offense." Landis told the judge the case was never viewed as "sexual in nature," partly because prosecutors could not prove the two young men had sexual intent. I'm fucking speachless now. I say death penality [flaming]
  4. Darkneon

    Interesting/funny videos

    Too many to post them all, but here are some nice ones. Nice sketch Priceless, your jaw will hurt Funny, but it's not funny
  5. Here's what I get using the InputBox. Dim randomGenerator As New Random Dim guess As Integer Dim count As Integer Dim number = randomGenerator.Next(1, 100) Dim playAgain As Boolean = True Do While playAgain = True count = 0 Do While count < 10 guess = Convert.ToInt32(InputBox("Please Enter a number:", "The Guess Game") If guess < number Then Me.uiGuessTextBox.Text = guess.ToString Me.UiDisplayResultsLabel.Text = "You guessed " & guess & " try a higher number." ElseIf guess > number Then Me.uiGuessTextBox.Text = guess.ToString Me.UiDisplayResultsLabel.Text = "You guessed " & guess & " try a lower number." Else Me.uiGuessTextBox.Text = guess.ToString Me.UiDisplayResultsLabel.Text = "Congratulations!" _ & "Hit replay if you would like to play again." count = 10 End If count = count + 1 Loop Me.UiDisplayResultsLabel.Text = "The number was " & number & _ ". Press replay to start again." Dim result As DialogResult result = MessageBox.Show( "Play Again?","The Guess Game", MessageBoxButtons.YesNo) If result = DialogResult.No Then playAgain = False End If Loop I think it should work. Play around with it, I need to go. Bye.
  6. It's because Do While count >= 10 needs to be Do While count < 10. In you else you put count = 0, if you change it to count = 10, this remove the need of the extra variable isGuessCorrectly that I put before.
  7. I lost you there. I'm not sure what you try to accomplish by putting If Count = 0 then... Here's the pseudocode I came up with than you would put in Form_Load(): Declare count, number, guess, isGuessCorrect, MaxNumberOfAllowedGuesses count = 0 number = randomGenerator.Next(1, 101) isGuessCorrect = False; Do While Count < MaxNumberOfAllowedGuesses And isGuessCorrect = False guess = Convert.ToInt32(InputBox()) if (guess < number) 'output message elseif (guess > number) 'output message else isGuessCorrect = True 'output winning message Increment Count Loop If isGuessCorrect = False 'output losing message 'output final message I have to go in 5 minutes. Edit: I added the isGuessCorrect to know when you get out of the loop if it is because the user guess correctly or because the number of allowed tries was reached
  8. Then you might want to go ane make yourself a coffee :P Boom, 2 logical errors right at the start. Can you find them in 15 seconds? - Count is 0 so " Loop While count >= 10" will be executed only once. - I wrote before: Initialize variables Do While guesses < MaxNumberOfAllowedGuesses Well, you put count = 0 and number = randomGenerator.Next(1, 101) inside your loop which is wrong.
  9. Well, there are many different ways to solve the same problem. How you solve it is up to you, but you normally choose the easiest and fastest solution. Analogically, there are many ways to describe the same thing. The choice of words is up to you. So I gave you one solution, and Adam gave you another. If you sit down and think some more, you might come up with another one. You can solve this problem without using the loop (look at Adam's code), if it is easier and faster for you, than go for it.
  10. No. Why would you want to skip the loop? You must use the loop and you must use the selection. The selection goes inside the loop.
  11. Yes, if you decide to use the InputBox, you can put you code in Form_Load. In a nutshell, your program will look something like that. Declare variables Initialize variables Do While guesses < MaxNumberOfAllowedGuesses 'Program Logic Loop 'Final output
  12. Hmmm did your teacher specifically asked to use textboxes and a button? Did she teach how to use the InputBox? Unless someone can correct me, what you try to accomplish is impossible without global variables. I guess static variables could be used, but if you don't know about global variables I doubt you know about static variables. I think you should review your program design and use a InputBox instead of a button. If your teach asked to use a button, then how to do this without global variables I don't know. You would need to list what you have learned so far maybe we could pin-point on something.
  13. hehe, that's not pseudocode, it's a logic execution. Pseudocode is when you use the syntax of the programming language mixed with english description. Did you learn about global variables? Also, I would suggest to print the value of you variables. For example, in the code that you posted, print the value of number, guess and count after they are declared. Then print them again after guess is initiallized. Then again after the second loop. Then again after the if condition. This is just to let you know what is going on with you program, it will help you spot the errors.
  14. Hey vanidosa27, There are a lot of logic errors in you code which makes it behave other than what you want it to do. Since it is a homework, I will throw you hints so you have something to think about. - Notice that the number to guess is recalculated every time the button is clicked, so is the counter. - "Do While guess <> number" at this point number was only declared... so it's 0! - Think what Nypyren said - Your condition " If guess > number ", do you see that it will always be executed only once? - Notice that the lines Else 'display try again Me.UiDisplayResultsLabel.Text = Convert.ToString("Try again.") End If will never be executed because you already have smaller than, larger than, or equal.
  15. Nimrand, you're the man! Like you said, I wrote an handler for AppDomain.CurrentDomain.UnhandledException and it returned an exception thrown by EndAccept(). Took me 2 seconds to fix it. The error? A very obscure one :) In my original code, I had the line Console.ReadLine() and right after I was closing my socket. As you can guess, in the Windows Service the ReadLine() was never taken into consideration so the socket was closed. Level up everybody. Darkneon
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!