Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

aei_totten

@aei_totten
About
Posts
57
Topics
26
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • reference can't be found works while in visual studio, but not outside
    A aei_totten

    I have a program that runs fine on several machines (xp, win7) however on one machine (vista) I get an error that it can't find one of the refernce dlls. I can run the project on that machine in visual studio, but when I click on the application (from the debug folder), it has the dll not found error. I have tried copying the dll pretty much everywhere unsuccessfully.

    C# csharp visual-studio debugging help

  • Server program error: Unable to read data from the transport connection
    A aei_totten

    I wanted to add that the dictionary looks fine after the user has been removed. And this works fine as long as everyone stays connected

    C# help sysadmin

  • Server program error: Unable to read data from the transport connection
    A aei_totten

    OKay, so I am writing a server program that connects many clients and sends them out data. The problem is that when a client disconnects, when trying to read from another client I get the error.."Unable to read data from the transport connection: An established connection was aborted by the software in your host machine." I have the connections saved in a Dictionary

    private Dictionary<TcpClient, string> Connections = new Dictionary<TcpClient, string>();
    //to add a client
    Connections.Add(tcpClient, currUser);
    // to remove a client
    Connections.Remove(tcpUser);

    //server just loops (in a separate thread for each connection)
    string message = srReceiver.ReadLine();

    //client code

    // setting up connection
    tcpServer = new TcpClient();
    tcpServer.Connect(IPAddress.Parse(ipaddress), port);
    swSender = new StreamWriter(tcpServer.GetStream());

    // sending stuff
    swSender.WriteLine("Whatever");
    swSender.Flush();

    // closing connection
    swSender.WriteLine("Close");
    swSender.Flush();
    swSender.Close();
    tcpServer.Close();

    C# help sysadmin

  • Modeless dialog issue
    A aei_totten

    That did it. I had tried previously checking if the dialog needed invoke but i didn't check this.invokerequired Thanks so much!

    C# testing beta-testing help question

  • Modeless dialog issue
    A aei_totten

    Thanks for the relpy. It does work fine from a button event or other main form generated event. However, I created a System.Timers.Timer and called the method from it's elapsed event handler and that created the same freeze as seen from the Cisco event handler.

    C# testing beta-testing help question

  • Modeless dialog issue
    A aei_totten

    well crud. I can't even reproduce that today :(

    C# testing beta-testing help question

  • Modeless dialog issue
    A aei_totten

    Found out something else. Even without the Dictionary, just moving the declaration of the Form out into the scope of the main form was not enough to fix the problem

    C# testing beta-testing help question

  • Modeless dialog issue
    A aei_totten

    Richard Blythe wrote:

    Hmm, so your saying that the following code would work:

    yes

    C# testing beta-testing help question

  • Modeless dialog issue
    A aei_totten

    Gregory.Gadow wrote:

    Added: After looking at the code you posted above, I can see the problem. After calling Show(), the method ends. The variable referencing your form goes out of scope and gets recycled: your form is not getting a chance to render before it gets disposed. If it absolutely has to be modeless, you will need to move the scope of your form's variable out.

    Now, that makes sense. However, in the real application, I have more demands of that form (I just wanted to get a simple one working first because I was running into this issue and couldn't pin point it). Here's some code.... private Dictionary<string, ChatMessageForm> chatMessages = new Dictionary<string, ChatMessageForm>(); ... string message, sender; message = "blah"; sender = "me"; if (!chatMessages.ContainsKey(sender)) { chatMessages.Add(sender, new ChatMessageForm(sender)); } chatMessages[sender].ShowDialog();} The Dictionary is declared outside of the process in the scope of the main form. However, i do think the issue is related. This is my first time using Dictionary so maybe I am missing something there...

    C# testing beta-testing help question

  • Modeless dialog issue
    A aei_totten

    Well the code looks a bit like this..... public partial class ChatMessageForm : Form { public ChatMessageForm() { InitializeComponent(); } } private void ProcessChatMessageEvent() { ChatMessageForm c = new ChatMessageForm(); c.Show(); } ProcessChatMessageEvent is called by..... public void OnEvent(Object sender, EventPublisher.EventPublisherEventArgs eventArgs) { EventID nReceivedEvent = (EventID)eventArgs.iEventID; switch (nReceivedEvent) { case EventID.eChatMessageEvent: ProcessChatMessageEvent(); break; } } I checked and it works properly outside of the switch which kinda amazes me. (The OnEvent is a Cisco event handler)

    C# testing beta-testing help question

  • Modeless dialog issue
    A aei_totten

    I don't have anything in any of the handlers. It has pretty much nothing in it. I put one button on it that doesn't do anything. (I was just testing). The only code in it is the public ChatMessageForm() { InitializeComponent(); }

    C# testing beta-testing help question

  • Modeless dialog issue
    A aei_totten

    I am trying to pop up a modeless dialog box using .Show() It does pop up the dialog, but it freezes and the components never load. I can open the same dialog with .ShowDialog() and it loads properly. But that doesn't accomplish what I am looking for in the dialog because i need it to be modeless. So, is there something that I am missing to make show work correctly? It is a pretty simple out of the box dialog that I am testing with, just from VS2008 designer with one button on it.

    C# testing beta-testing help question

  • Panel Issues
    A aei_totten

    OKay I got it.

        static void SetVisible(Control ctrl, bool visible) 
        {
            if (ctrl.InvokeRequired) 
            {
                object\[\] params\_list = new object\[\] { ctrl, visible };
                ctrl.Invoke(new SetVisibleDelegate(SetVisible), params\_list);
    
            }
            else 
            {
                ctrl.Visible = visible;
            }
      }
    
    C# help tutorial question

  • Panel Issues
    A aei_totten

    OK so I found something. Though I set the text values in a thread safe manner apparently I don't set the panel's visible property in a thread safe manner. Any suggestions on how to do that? Please don't say a timer, because I have had such bad luck with the form timers in this program. I just can't get them to tick, but that is another issue. Edited to add: Weird I didn't see that last reply until after I posted this. I will check out the link. Thanks

    C# help tutorial question

  • Panel Issues
    A aei_totten

    I am having some weird panel issues. In my program I have multiple panels of different contents. For example there is a welcome screen, the user clicks next and the welcome screen is not visible and the next screen is.When the screens are changed with the next button they work fine. Here is where the problem is... However if I want to change them from a seperate thread, the panel is visible but the contents of the panel are not. I am calling the same function to change the panels' visiblity (and the contents have all been set to visible). I have made sure that all labels were changed using the invokerequired/settextcallback stuff. What am I forgetting?

    C# help tutorial question

  • christmas exchange list generator
    A aei_totten

    the problem I worry about with that is if you don't start with the longest list, then you might end up at the end with only members of one family

    C# data-structures tutorial regex question

  • christmas exchange list generator
    A aei_totten

    Here is what I am trying to do. I have treeview that is full of a family tree. Example parent1 -spouce1 -kid1 -secondkid1 parent2 -kid2 parent3 -spouce3 -kid3 parent4 (but I don't really know how many parents and kids there are. So, now what I want to do is randomly match up each person with someone else, but not someone in thier own node. For example, I don't want parent1 to get matched up with his spouce or kids, but he would be fine matched up with parent2 or his kid. My brain is about mush right now and I am not thinking of how to do this, though there must be a simple way. My original idea was to put everything into arrays. Then choose the longest array and randomly chhose another array then randomly choose a member of that array to match up with the first person, then remove both people from the arrays and calculate the longest array again and repeat until there is no one left. But implementing the idea seemed more complicated and I thought there must be an easier way, no?

    C# data-structures tutorial regex question

  • Serial Com controlling DTR & RTS
    A aei_totten

    this is going to sound so stupid. But it works now :) I had the OScope on the wrong pin. ~Brandy

    C / C++ / MFC com help tutorial question

  • Serial Com controlling DTR & RTS
    A aei_totten

    okay what I want to do is be able to open a serial port and then set and clear the str and rts whenever I want to. For example: open com port do stuff set dtr send data wait so long clear dtr Hear is what I have tried that I thought should work:

    	int result = EscapeCommFunction(\_hCom,SETDTR);
    	//send a byte
    	WriteFileEx(\_hCom,"\\xFF",1,test,0);
    	//wait 4 ms
    	Sleep(4);
    	result = EscapeCommFunction(\_hCom,CLRDTR);
    

    this was unsuccessful though the EscapeCommFunction returned successful (1). Since that didn't work I tried this

    	BuildCommDCB("dtr = on", &dcb);
    	SetCommState(\_hCom, &dcb);
    	//send a byte
    	WriteFileEx(\_hCom,"\\xFF",1,test,0);
    	//wait 4 ms
    	Sleep(4);
    	BuildCommDCB("dtr = off", &dcb);
                SetCommState(\_hCom, &dcb);
    

    which was equally as unsuccessful. What am I doing wrong? edited to try to fix reference (&) marks

    C / C++ / MFC com help tutorial question

  • howto Post Message
    A aei_totten

    okay working with a dialog app. I have a little worker thread doing stuff and then I want to update the dialog. So here is what I am doing... #define UWM_UPDATEGRAPH (WM_APP + 1) //{{AFX_MSG_MAP(CVC_ExampleDlg) ... ON_MESSAGE(UWM_UPDATEGRAPH, OnUpdateGraph) ... //}}AFX_MSG_MAP // I ignore both params LRESULT CVC_ExampleDlg::OnUpdateGraph(WPARAM, LPARAM) {...} now to post this message I thought I wanted to write PostMessage(UWM_UPDATEGRAPH, 0, 0); however it is asking for an additional parameter of the HWND. So here is my question, did I define my message wrong or do how is the best way to get the HWND

    C / C++ / MFC question announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups