User Profile

Collapse

Profile Sidebar

Collapse
foahchon
foahchon
Last Activity: Dec 18 '11, 03:36 AM
Joined: Aug 27 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • foahchon
    replied to Listbox doesn't show data
    If you want the ListBox to display a member in the Customer class (like the customer's name, for instance), you need to override the ToString() method in the Customer class:

    Code:
    public override string ToString()
    {
        return String.Format("{0} {1}", this.FirstName, this.LastName);
    }
    ...or something similar.
    See more | Go to post
    Last edited by foahchon; Dec 13 '11, 01:32 AM. Reason: Forgot keyword.

    Leave a comment:


  • foahchon
    started a topic C#-Form: Difficulties with threading and new forms
    in .NET

    C#-Form: Difficulties with threading and new forms

    Hi, I'm trying to write an IRC client (yeah, another one), and I've written a component that creates a thread that polls a socket for new information, parses new lines, and calls associated events (for example, an OnJoin delegate is called when a room is joined).

    My problem is, I want a new form to be created when a room is joined, but every method I've tried for doing so creates either a modal form (not the desired type), or a form...
    See more | Go to post

  • foahchon
    started a topic C# - Begin/EndReceive Loop Woes
    in .NET

    C# - Begin/EndReceive Loop Woes

    Hi, I'm trying to write a receive loop in my socket class that will receive what data is in the buffer, call an event to let the user know that there's new data, and then receive the rest of the data. It kinda almost works; it receives much of the data, but seems to miss the last packet or two. Here is the code in the loop:

    Code:
            private void OnSockReceive(IAsyncResult ar)
            {
                try
    ...
    See more | Go to post

  • foahchon
    replied to Knight's Tour recursive problem
    in C
    I solved it (I think). I changed the last line in KnightsTour() to "return false;" to this:

    Code:
    if (!KnightsTour(board, (xCoor + 1), (yCoor - 2), xSize, ySize, (moveNum + 1)))
    {
        board[xCoor][yCoor] = 0;
        return false;
    }
    Thanks for all your help.
    See more | Go to post

    Leave a comment:


  • foahchon
    replied to Knight's Tour recursive problem
    in C
    Thanks for your replies.



    I don't see that condition anywhere. There is (board[xCoor][yCoor] != 0), and I tried modifying that to (< moveNum), but then the board was changed completely to zeroes.



    Thanks for your time. That's pretty much what the KnightsTour() function that I have now does, I think. One thing it doesn't do, though, is set the cell to zero. I tried adding code earlier...
    See more | Go to post

    Leave a comment:


  • foahchon
    replied to Knight's Tour recursive problem
    in C
    Thanks for your reply. I've added some commenting. Hopefully this helps:

    Code:
    #include <iostream>
    #include <iomanip>
    
    using namespace std;
    
    // Function prototypes.
    void InitializeBoard(int **board, int xSize, int ySize);
    void DisplayBoard(int **board, int xSize, int ySize);
    bool KnightsTour(int **board, int xCoor, int yCoor, int xSize, int ySize, int moveNum);
    ...
    See more | Go to post

    Leave a comment:


  • foahchon
    started a topic Knight's Tour recursive problem
    in C

    Knight's Tour recursive problem

    Hi, I'm trying to write a program to solve (or whatever) the Knight's Tour. I know this is a pretty common problem, but I haven't found a solution that I can really compare mine to and isolate what the problem(s) is/are. I have an idea as to what the problem is, but let me first post my code:

    Code:
    #include <iostream>
    #include <iomanip>
    
    using namespace std;
    
    void InitializeBoard(int
    ...
    See more | Go to post

  • foahchon
    replied to Bizarre cin.get() problems (I suspect)
    in C
    Thanks a lot for your reply. I figured I might have to use cin.ignore(), I just wasn't sure where or how. The value of the SIZE constant is 101. The maximum number of characters allowed in order for a string to be valid is 100, plus a terminating null character. Should I use the SIZE constant in the cin.ignore() call, instead of 1000, which seems to be generic?
    See more | Go to post

    Leave a comment:


  • foahchon
    started a topic Bizarre cin.get() problems (I suspect)
    in C

    Bizarre cin.get() problems (I suspect)

    Hi, I'm trying to write a simple program (or portion of a program), that will re-prompt a user for input each time the user enters invalid input, and then exit once the user has entered valid input. Here's what I have so far in main():

    int main()
    {
    char input[SIZE];

    cout << "Enter a string: ";

    while (!InputString(i nput))
    {
    cout << "Invalid string...
    See more | Go to post

  • foahchon
    replied to Boost .lib files installation
    in C
    Hi, thanks for your reply. I don't get a "create directory?" prompt. In fact, now I'm getting two notices when I try to run bjam: "don't know how to make <e>C:\Program Files\Microsoft Visual Studio\VC98" (even though I added the additional backslash), and "don't know how to make <e>install."

    I copied some files around after I got "no Jamfile found" message, but now I get a message...
    See more | Go to post

    Leave a comment:


  • foahchon
    started a topic Boost .lib files installation
    in C

    Boost .lib files installation

    Hi, I tried building one of the examples from Boost's website in MSVC++ 6.0, but I got an error from the linker saying that it couldn't find a certain .lib file. So, I downloaded boost-build and bjam, built bjam, but I can't seem to get bjam to work. I am using bjam v2. Here are some of the command lines I've tried:

    bjam -sTOOLS=msvc install (v1 syntax should work unless overridden with --v2 parameter)

    This produces...
    See more | Go to post

  • foahchon
    replied to Copying pieces of char array to string
    in C
    Thanks for you reply, but I wanted to copy some text from the buffer[] array to the string Temp. Is there a way to do this, or should I first copy some stuff from buffer[] to another temporary char array, and then convert that char array to a string?
    See more | Go to post

    Leave a comment:


  • foahchon
    started a topic Copying pieces of char array to string
    in C

    Copying pieces of char array to string

    Hi, I'm trying to write a class that will use ifstream to first extract a file's header into a char array, but then I want certain sections of that char array copied into a C++-style string (that is, the string class). Here's the code I have so far:

    ifstream TheFile;
    TheFile.open(Op enFileName,ios: :in | ios::binary | ios::_Nocreate) ;
    char *buffer = new char[512];
    TheFile.read(bu ffer,512);
    string Temp;...
    See more | Go to post
No activity results to display
Show More
Working...