|
Thanks for the quick reply, I appreciate it.
Yes, the multiple _sp.Write()'s work just fine. The flow of the program is as such: Program Loads. Main Class creates a new thread (the thread is another class). The thread then creates an initializes a SerialPort variable, and opens the COM PORT. Next, that thread creates the Provider (TcpServiceProvider) and starts the server. (It has an AsyncCallBack that calls a method within the TCPServer class when data is received from the TCP port). After it does that stuff, I basically have a while (running) { } loop in there that just keeps it running until you press the close button. (I put code in there to write to a file while it was running, and it runs non-stop). While it is running, it is basically calling SerialPort.ReadExisting() to get what's in the buffer (if anything). It just keeps looping and checking the incoming com port buffer for text. If it sees any text, that thread calls the TCPServer class "SendString" method to send out the string. That works totally fine, when I send data into the COM port on my PC, it immediately shows up in the telnet window. When I type in the telnet window, a message box pops up saying "I received this text: " and the text, directly after the message box text it does the _sp.Write() method, but nothing ever shows up on the COM port at that point. But, if I go ahead and type some more stuff on the COM port after that, it shows up in the telnet window (so that is telling me that the COM port is being held open). The odd thing is that no errors are thrown and no exceptions or program crashes are happening and I'm totally stumped at this point.
Again, thanks for the help, it is gladly accepted
*** Addendum: I just loaded this up in debugger as the other poster had mentioned, and I get the following error:
A first chance exception of type 'System.NullReferenceException' occurred in TcpServerDemo.exe
So it does appear that at some point that local pointer:
_sp = sp;
is getting wiped out for some reason?
|
|
|
|
|
Seems like a really weird problem you're having there. I can't image that the private variable is wiped out for some mysterical reason. At least it would be the first time i hear of something like this. Are you sure the exception is thrown when you access the _sp variable? Do you have any code that changes this variable other than the Set function that may be executed for some reason? I think the best would be adding a breakpoint in the Write method of your serial port and check step by step what goes wrong. (as mentioned)
www.troschuetz.de
|
|
|
|
|
Does anybody know's a free obfuscator for .net? One that can do the job and not mess the code up...
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
|
Thank you.
When I mentioned about messing up the code I ment messing with the functionality too - I used a not so famous obfuscator and it maked my assemblies to give errors at runtime (that without obfuscation from that application would not appear).
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Yeah, I hear you. My opinion of obfuscators is that they're a hack; they break functionality, especially in .NET remoting apps. I've yet to find one that really works on our large client/server app.
|
|
|
|
|
Like Judah said, the point of an obfuscator is to make the code harder to read by removing context (i.e. messing it up). The point being that it makes reversing engineering of your code harder. So for an obfuscator to do it's job it will need to mess around with the code.
|
|
|
|
|
I have a problem whith aplication on the server..this
server back me this message:
The server viewstate cache has timed out. The application was unable to successfully recover state. To address this exception, modify your web.config to use client-side viewstate caching, or to extend the server cache timeout value.
|
|
|
|
|
|
Hi friends
I want some help regarding Textbox editor like when we compose mail then it gets formatting (ex: Bold, Italic,Underline,spell check etc..).
In Web apllication (ASP.NET with C#).\
Thanking u,
Naren
please help me
|
|
|
|
|
I don't think there's anything like that out of the box. You may have to author something like this yourself or purchase a component that does this for you. But, I'm no ASP.NET exptert; perhaps this would best be answered in the appropriate forum[^].
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: How 'bout a little guitar now?
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
I need to have a database of all runned applications. I have a server - terminal, and other users log in terminal. I need to have a list of running applications, of its owners etc...
And of course I want to know how can I update my Database effectively!
Please help me...
P.S. Sorry of my bad English. It's not my native language!
|
|
|
|
|
|
Hi everyone,
I've got a problem and I can't solve it with anything! I have a button that when one clicks on it a groupbox is enabled showing a label with the value of a row which was random from a database. Then when one clicks the next button another question is random and displayed in the same label.Now I would like that after the user clicks the next button for ten times, it is disabled. How can I do this?
Thanks
|
|
|
|
|
Can you elaborate on the problem?
Is it disabling the button? Is it selecting random questions from a database? Is it keeping track of ten clicks?
Help us help you.
--
I've killed again, haven't I?
|
|
|
|
|
Yes a new question is random everytime I click the Next button. But it's not keeping track of the ten clicks that the user makes since I don't know how and at the moment the button is not disabled.
|
|
|
|
|
Create a variable, e.g. userClicks . Initialize it to 0. In your button's Click handler, increment the value of userClicks , and if it is 10, set the button's Enabled property to false .
--
I've killed again, haven't I?
|
|
|
|
|
Thank you, Thank you
I've done it
|
|
|
|
|
just use an INVISIBLE TextBox control to store the track and count of the clicks.
|
|
|
|
|
Hi Alee
It would be helpful if you told us whether this is a windows- or web application. But I guess you're talking about web.
You could store the number of times in ViewState (a hidden form field on the webpage)
Something along the lines of:
http://www.sweetsilence.dk/codeprojectprojects/limitedclicks/[^]
Here is the code below, also available at:
http://www.sweetsilence.dk/codeprojectprojects/limitedclicks/limitedclicks.zip[^]
--------------------------------------------------------------------------
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblQuote;
protected System.Web.UI.WebControls.Label lblNumberOfClicksLabel;
protected System.Web.UI.WebControls.Label lblNumberOfClicksValue;
protected System.Web.UI.WebControls.Button btnShowQuote;
protected int NumberOfClicks
{
get
{
if(this.ViewState["clicks"] == null)
return 0;
else
return (int)ViewState["clicks"];
}
set{this.ViewState["clicks"] = value;}
}
private void btnShowQuote_Click(object sender, System.EventArgs e)
{
if(this.NumberOfClicks < 10)
{
lblQuote.Text = GetQuote();
NumberOfClicks++;
}
else
{
lblQuote.Text = "[no more quotes for you!]";
lblQuote.ForeColor = Color.Red;
}
}
public string GetQuote()
{
if(this.NumberOfClicks % 2 == 0
return "Even is pretty good";
else
return "Odd is good too ; )";
}
private void WebForm1_PreRender(object sender, System.EventArgs e)
{
lblNumberOfClicksValue.Text = this.NumberOfClicks.ToString();
}
}
Three kinds of people in the world:
- Those who can count..
- Those who can't!
-- modified at 14:47 Thursday 6th April, 2006
|
|
|
|
|
Actually at the moment I'm working with windows and when I'll be ready I'm going to do it in a web application.
|
|
|
|
|
|
I want to design custom Menubar control. For that i am deriving a new class from MenuStrip. I want to add some custom functionality to this control. The tabs in the popup menu should have custom color on hover. We are planning to use toolstriprenderer for the same.
I would like to know if the toolsriprenderer is fine or some other approach is required.
|
|
|
|
|
|
Can I declare virtual Columns in my program? Imagin I have a table (ID and Name)
and in my search comand I retirieve data (one column)from another table and it's added to my dataGridView( where I show the results), I want to be able to creat one virtua column in this table where it doesnot exist in my main database.
I know there is such thing in DELPHI, i'm not sure we have such thing in C# ?!
Thanx
Mr.K
|
|
|
|