Display text line once
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: Display text line once

  1. #1
    Join Date
    Dec 2008
    Posts
    86

    Display text line once

    I have to display IP addresses in LAN in edit box one below another everytime I refresh the screen.
    I have used this....

    Code:
    ((CMessengerDlg*)m_pDlg)-> m_IPAddresses =  ((CMessengerDlg*)m_pDlg)-> m_IPAddresses + SendersIP + MultiLine;
    				
    ((CMessengerDlg*)m_pDlg)-> UpdateData( FALSE );
    But, everytime I refresh, the same copies of the IP addresses get displayed one below another. i.e. if i refresh it twice, the same set of ips get displayed twice one below another.

    I want to display one IP only at one line(& not many copies of it) even if I refresh many times.

    Is Linked list the only solution to this problem?????(I have been suggested so)

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,517

    Re: Display text line once

    Sorry, I couldn't understand your problem...
    But, perhaps, replacing an Edit control with the LisBox would solve your problem?
    Or getting rid of UpdateData() and using CEdit methods like SetSel/ReplaceSel could help you?
    Victor Nijegorodov

  3. #3
    Join Date
    Dec 2008
    Posts
    86

    Re: Display text line once

    I am finding it difficult to explain it in the words....
    I am putting the image of the output window.
    Please look at it

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,517

    Re: Display text line once

    Quote Originally Posted by scorrpeio View Post
    I am putting the image of the output window.
    Please look at it
    There is nothing to look at in your post (neither any image nor an attachment)
    Victor Nijegorodov

  5. #5
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,062

    Re: Display text line once

    Also tell us what m_IPAddresses, SendersIP and MultiLine are. What type of variables are they?

    Also, which IP addresses you want to display one after the other? Do you have 1 list of IP addresses that you want to show in a list or what?

  6. #6
    Join Date
    Dec 2008
    Posts
    86

    Re: Display text line once

    Quote Originally Posted by Marc G View Post
    Also tell us what m_IPAddresses, SendersIP and MultiLine are. What type of variables are they?

    Also, which IP addresses you want to display one after the other? Do you have 1 list of IP addresses that you want to show in a list or what?

    I am putting the required files also, & telling it in short here also,

    CString m_IPAddresses -> the variable of the read only exit box
    CString SendersIP -> the variable used in the function REceiveFrom(), to get the IP of machine which sends message.
    Multiline & the VSCroll are true.


    Initially I will transmit the broadcast message, the machines which are listening to me will send reply. SO, I should display the IP of all the machines which are listening to broadcast & replying, one below another.....just like LAN messenger / ip messenger
    Attached Files Attached Files

  7. #7
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Display text line once

    Hm, so where is the output? You said you'd show it to us.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  8. #8
    Join Date
    Dec 2008
    Posts
    86

    Re: Display text line once

    the image is of size greater than specified so I cant attach it....

    But, the code will make you understand, isnot it???

  9. #9
    Join Date
    Dec 2008
    Posts
    86

    Re: Display text line once

    I have zipped it.....the output window showing what is exactly happening with me...
    Attached Files Attached Files

  10. #10
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,062

    Re: Display text line once

    I don't have time to analyse the code in details.
    But did you run this in a debugger?
    I would run it in a debugger, put a breakpoint at "ChekReceived = ReceiveFrom( ReceivedBuf,4096 , SendersIP, SendersPort );" and check the values in the debugger. It's probably not a problem with displaying the IP address but you might be getting the wrong addresses in SendersIP.

  11. #11
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,196

    Re: Display text line once

    This looks to me like you're appending data when you probably want to replace it.

    ((CMessengerDlg*)m_pDlg)-> m_IPAddresses = ((CMessengerDlg*)m_pDlg)-> m_IPAddresses + SendersIP + MultiLine;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center