Search Results - CodeGuru Forums
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: Jim_Auricman

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Re: using break statement in a while loop

    Coding standards were developed because frequently someone else will have to maintain your code, and having the code work will not necessarily make it understandable and maintainable. Using "break"...
  2. Re: using break statement in a while loop

    If you use the while statement as follows:

    bool finished = false;

    while ((!finished) && (!_backgroundWorker.CancellationPending))
    {
    //When the exit condition is met-
    finished =...
  3. Re: System.Random is a type but is used like a variable

    You just need 6 variables:
    int con1 = rng.Next(0, 17);
    int vo1 = rng.Next(0, 5);
    int con2 = rng.Next(0, 17);
    int vo2 = rng.Next(0,...
  4. Re: System.Random is a type but is used like a variable

    The code is doing what you told it to do in this statement:
    Console.WriteLine(conlist[con] + volist[vo] + conlist[con] + volist[vo] + conlist[con] + volist[vo]);
    since you are only using one index...
  5. Re: System.Random is a type but is used like a variable

    Thanks, BPE.
    x = Console.ReadLine();
    This line also needs to be within the do-while loop, otherwise x never gets updated.
  6. Re: System.Random is a type but is used like a variable

    int con = rng.Next(0, 21);

    The conlist is only 17 elements, but con could be as large as 21, so eventually it may crash by being out of bounds.
  7. Re: Having trouble building this converter without using goto

    I made a couple minor changes to your structure:


    string eval = "";
    bool finished = false;

    while (!finished)
    {

    ...
  8. Thread: Zeros...

    by Jim_Auricman
    Replies
    12
    Views
    1,053

    Re: Zeros...

    Believe it or not, I have seen code that used multiple entry into functions. Back in the days when code space and execution time was very critical, some functions were written with several different...
  9. Thread: Zeros...

    by Jim_Auricman
    Replies
    12
    Views
    1,053

    Re: Zeros...

    "Yes, if you really want to avoid multiple returns then this is the way to do it. But it isn't as easy to read as the solution given by BioPhysEngr (with my correction). "

    If you follow the coding...
  10. Thread: Zeros...

    by Jim_Auricman
    Replies
    12
    Views
    1,053

    Re: Zeros...

    Here is another solution:


    string stripZero(string OriginalNumStr)
    {
    string ModNumStr = OriginalNumStr;
    int DotIndex = OriginalNumStr.IndexOf('.');

    ...
  11. Re: Reading text file by character

    You might want to try reading in using a BinaryReader and writing out using BinaryWriter.
    BinaryReader r = new BinaryReader(fs);

    binWriter = new...
  12. Re: C# can't figure out whats going wrong

    You didn't mention what the problem is, but
    if (grade > 50)
    {
    GPA = 0.0;
    }
    so any grade above 50 will yield a GPA of 0.0. I don't think you want that.
  13. Replies
    18
    Views
    1,551

    Re: Please don't cringe

    No, you are not in the minority. If you make it a popularity contest, of course you will win.
    People like to take the easy way out and don't care about who has to maintain their code later.
    If you...
  14. Replies
    18
    Views
    1,551

    Re: Please don't cringe

    BPE, I have programmed using coding standards that strictly forbade the use of goto, continue and multiple returns from a function. I didn't write the standards, but I agreed with them and followed...
  15. Replies
    18
    Views
    1,551

    Re: Please don't cringe

    BPE, I share your aversion to goto, but I have a similar aversion to 'continue'. I have never used it, since it is easily avoided.
    Assuming your code is correct (I haven't tested it), I have...
  16. Re: Cannot implicitly convert type "string" to "int"

    You have guess defined as an int, but Console.ReadLine() returns a string. That is the mismatch. That's why I gave you this line:
    string guess_str = Console.ReadLine();
    Then you can convert it to...
  17. Re: Cannot implicitly convert type "string" to "int"

    BioPhysEngr, I agree that using "goto" is a bad practice. But why do modern languages, including C#, allow its usage? It is an unnecessary statement so it shouldn't be included in the language.
  18. Re: Cannot implicitly convert type "string" to "int"

    The guess string must be converted to an int before the comparison takes place.
    Here are a few hints:


    guess_str = Console.ReadLine();
    guess_str =...
  19. Re: MDB DataTable Fehler OleDbAdapterUpdate.Udate()

    Vielleicht wenn Sie die Frage auf Englisch stellen würden, würde jemand verstehen und Ihnen helfen.
  20. Re: Need streamreader to read content of multiple files

    I think you mean a wildcard "*.txt" rather than ".txt" in the Directory.GetFiles() function call.
  21. Replies
    10
    Views
    716

    Re: If Statement w/Message Box

    The operation Double.Parse(txtFat.Text); is failing because the text is invalid.
    It would be good if you had used the try{ } catch {} around that operation so you could have a messagebox in the...
  22. Replies
    10
    Views
    716

    Re: If Statement w/Message Box

    //declare variables
    double dblFat;
    double dblCarbs;
    double dblFatCalories;
    double dblCarbCalories;
    double dblTotalCalories;

    //assign values
    dblFat = Double.Parse(txtFat.Text);
    dblCarbs =...
  23. Replies
    3
    Views
    473

    Re: If statement help

    Try this:
    if ((currentKeyboardState.IsKeyUp(Keys.A)) && (!currentKeyboardState.IsKeyDown(Keys.D)))
  24. Replies
    14
    Views
    971

    Re: Simpler suggestion?

    "I've never like the idea of having to enumerate the controls to detect whether a radio button was selected"
    "you could simply add the index to the radio button's Tag property and that would solve...
  25. Replies
    14
    Views
    971

    Re: Simpler suggestion?

    Thanks for the further suggestions, foamy & Peter. I now simply set the Tag member to represent the Antenna number for that RadioButton when the RadioButton is created in the Design. This greatly...
Results 1 to 25 of 66
Page 1 of 3 1 2 3


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center