|
|
I think your primary thread is exiting before your worker thread has a chance to execute anything.
The MSDN sample code for EndAcceptSocket has this code after the call to BeginAcceptSocket in your BeginAcceptSocket() call.
clientConnected.WaitOne();
If that doesn't do what you need it to, then you can add some other blocking call to wait for a signal to exit your application.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
|
I'm pretty sure the problem is that ClientConnected is running on a separate thread already. You can verify this by checking the thread id in ClientConnected and before you call BeginAcceptSocket. I suspect what is happening is that your main application thread which is blocking on the BeginAcceptSocket call is waking up when the EndAcceptSocket call is made. Since there is no more code for it to execute it exits. When your main thread exits it shuts down all threads which doesn't give the thread running ClientConnected a chance to finish.
Using the GridView is like trying to explain to someone else how to move a third person's hands in order to tie your shoelaces for you.
-Chris Maunder
|
|
|
|
|
|
Using vs2005, from the data explorer window, I can add a new connection and bring my data in. Using the datagrid view, I can attach a table to view my data.
I can also use sql statement to view the data table to the grid. Although I haven't tried both of them on the same application. It looks like it is fater to display the data to the grid from the data explorer than using sql statement.
What I mean, I mean that an application that use the database explorer to bring data in should be faster than one that use sql statement.
I tried both of them in different application, I have seen that it always take more time for the sql statement to run than fill the grid. The way I look at it, by using the databse explorer, when the application is loaded or run, the connection and the data tables are also initializeed. Therefore, it is faster, which is opposed to runing sql statement. When I use sql statement here, I mean I mean something like oledbconnection.
Let me know if I am right.
|
|
|
|
|
Try do not to use OleDBConnection, use the respective "professional" data connection. eg. for MS Sql Server, use SqlConnection, while for Oracle, use OracleDataConnection.
yes, the connection built by data explorer seems to be faster than the manual built one. but it's just because the former will be initiallezed at the very begining of the application start. for the latter, if you try more times, you will find it has the same speed with the former one; and, it's more flexible
A Positive Thinker
|
|
|
|
|
What is the difference between oledbconnection and sqlconnection? I have been using oledbconnection. I have seen a lot of people using oledbconnection. I am using ms accesss just for testing, that will change later when I get sql express working. Can I use sql connection for ms access database?
|
|
|
|
|
Hi All
How can i find the first three characters of a string ??
thanks
Simon
|
|
|
|
|
si_69 wrote: How can i find the first three characters of a string ??
Doh !
string result = t.Substring(0, 3);
|
|
|
|
|
string s = "blablabla";<br />
s.Substring(0, 3);
|
|
|
|
|
System.DateTime.Now returns a date in this format "12/13/2006 4:34:00 PM"
I want it to display the date in this format "12/13/2006 16:34:00" instead.
I can see using GetDateTimeFormats that I need to use format number 74.
How do I do this?
|
|
|
|
|
|
System.DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Civic06 wrote: System.DateTime.Now returns a date in this format "12/13/2006 4:34:00 PM"
No, actually it doesn't.
It's a common misconception that a DateTime value has a specific format. It doesn't. It's when you convert the DateTime value into a string that it gets it's format.
If you don't specify any format when you convert it, it uses the format of the default culture. If you want a specific format, you have to specify that when you convert it.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
Hi,
I have the following problem: I am selecting specific row using command:
datagridview.Rows[RowIndex].Selected = true;
Now, desired row is selected but how to scroll to it because it doesn't do it automatically.
Can somebody heeeeelp, please
Aleks
|
|
|
|
|
One method is to set the CurrentCell property:
datagridview.CurrentCell = datagridview.Rows[RowIndex].Cells[0];
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
O Gee, you 'r pure genious. I would never think of it that way.
Thaaaaanks a lot
|
|
|
|
|
Hi,
Is there a way to tell if a form is on top of all the other windows application. In another word, I want to know if the form covered by somthing or fully visible to user.
Thanks in advance for any suggestion!
Alan
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
One way to do this might be to get the form's Graphics.ClipRegion and compare it with the region for the entire form its bounds with that of the form. If they aren't equal, the form is partially occluded.
/ravi
-- modified at 16:35 Tuesday 12th December, 2006
|
|
|
|
|
|
I can't use SetValue in the normal way because I the name of the class is treated as a type, not an object to call a method on.
<br />
Type myType = typeof(MyStaticClass);<br />
myType.GetProperty(PropertyName).SetValue(MyStaticClass,newValue,null);<br />
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Pass in null . I wrote a quick example and it worked fine.
myType.GetProperty(PropertyName).SetValue(null, newValue, null);
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Looks nicer than the InvokeMember call I found too.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Answer found with additional googling.
myType.InvokeMember(PropertyName, BindingFlags.SetProperty | BindingFlags.Default,null,null,new object[] {newValue);
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|