|
Message Closed
modified 27-Apr-15 11:09am.
|
|
|
|
|
Change your code, and try this one :
private void MakeConnection()
{
if (tcpl.Pending())
{
Socket YeniSoket = tcpl.AcceptSocket();
Soketler.Add(YeniSoket);
MessageBox.Show("new connection established!","new connection",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
then :
private void IstemciKontrol(object o, ElapsedEventArgs args)
{
Thread thread = new Thread(new ThreadStart(MakeConnection));
thread.Start();
}
|
|
|
|
|
Hi all,
I have created Client Server application for chatting
I have a server application that runs continously,
I have a client application that starts and connects to the server
the server gets the request and connects to the client application
The client application gets the list of all connected users
Now the client itseld is thread running asynchronously,
Now i want the user to select a user from the list and start a private
conversation with that user.
I have downloaded the code from http://www.mastercsharp.com/article.aspx?ArticleID=68&&TopicID=14[^]
I have modified the server code to receive some special message so that the server can know that a specific user wants to chat with another user privately.
The problem is the client thread receives the message from the server and
i start a new client from there, but the new client window does not displays the controls on it.
Instead the window looks as if the processing is not completed,
but the application continues with other processes.
Actually not getting where the problem is
If any one could give a link for multithreaded Client Server application
that will be appreciated greatly.
Thanks & Regards,
Pramod
|
|
|
|
|
When the Listbox is populated in C# i want to add the String as well as DataValue for it.
After adding the Value for the String Text i need to retrive it. Can anyone suggest me how to overcome this?
Avinash Deshpande
|
|
|
|
|
Create a new class with 2 properties (Text and DataValue).
class MyItem
{
public string Text = string.Empty;
public object DataValue = null;
public override string ToString()
{
return Text;
}
} Then use this class for adding items to listbox, for example:
for(int i = 0; i < 10; i++)
{
MyItem myItem = new MyItem();
myItem.Text = i.ToString();
myItem.DataValue = DateTime.Now;
this.listBox1.Items.Add(myItem);
} If you select item, than you can get each object using:
MyItem myItem = this.listBox1.SelectedItem as MyItem;
|
|
|
|
|
How can i change border style of axwebbrowser? by default it shows 3D . i want to change it.
thanks
|
|
|
|
|
Hi
I have a class that inherits from DataGrid. I can set the rowheights in a
DataGrid by tappig into the "get_Datagridrows" method. However, this does
not work for classes that inherit from DataGrid. Anyone know how to do this
on derived classes? I find it apalling that Microsoft provided a DataGrid
that is so inflexible!
Regards
Kais
|
|
|
|
|
How to convert IDL file to C#, is there any compiler supporting this language?
With regards,
Manickam.AT
(patkatm@yahoo.com)
|
|
|
|
|
|
Hello,
I need some help to understand something,
I writing some program that need to add some object by using hash Table.
I have already the object but this object don't have some var that will define hash code [ beside the method GetHashCode of object ].
I want to use the method GetHashCode but before using this method - i need to set the hashCode to be some value that i need.
How i set this value ?
How do i using the exist hash Code and the method GetHashCode ?
Thanks for any help.
|
|
|
|
|
You must derive Hashtable class, and write your own GetHashCode() function.
|
|
|
|
|
I dont understand - do you have some example ?
I realy need help....
|
|
|
|
|
If you are using Hashtable.GetHashCode() then you can only get some number like 1,2,3...
That number is internally managed from class Hashtable. You cannot set the number.
If you want to set the Hashcode in class Hashtable, then you must derive class Hashtable and
use override GetHashCode().
Hashtable is a table for some pair for key-value. If you want to add some hashcode in each
of key-value pair, then you must add property "Hashcode" to your object.
|
|
|
|
|
Hello!
The result of GetHashCode() is used by Hashtable to put your data into the appropriate buckets.
MSDN has some extensive documentation on overriding GetHashCode() , so I think the best way would be to start reading there.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi,
I have a Tab control which has 4 different tabs say Tab0,Tab1,Tab2,Tab3, i want to focus/show the Tab3 from Tab0 when cliking any buttons or after some code.
I have used the following code
tab3.show();
But it didnt work out what should i do?....
|
|
|
|
|
use
tabcontrol1.SelectedIndex = 3;
where tabcontrol is the initial control on which tabs are created.
Regards
Shajeel
|
|
|
|
|
Thanks!!!
|
|
|
|
|
Hi,
I have created a custom grid class which inherits from the DataGrid class.
Using reflection i want to invoke on of the private method of the base class. Am able to list all the public method, but not able to get the refernce to the private methods. Attached is the class am using.
<br />
public class CustomDataGridTest : DataGrid <br />
{<br />
<br />
<br />
private DataTable PopulateTable()<br />
{<br />
DataTable dt = new DataTable();<br />
dt.Columns.Add("Name");<br />
dt.Rows.Add(new object[] {"John"});<br />
dt.Rows.Add(new object[] {"Miller"});<br />
dt.Rows.Add(new object[] {"Lara"});<br />
dt.Rows.Add(new object[] {"Tommy"});<br />
dt.Rows.Add(new object[] {"Robin"});<br />
return dt;<br />
}<br />
<br />
public MethodInfo GetMethodInfo()<br />
{<br />
this.DataSource = PopulateTable();<br />
<br />
MethodInfo mi = base.GetType().GetMethod("get_DataGridRows", <br />
BindingFlags.FlattenHierarchy | BindingFlags.IgnoreCase | BindingFlags.Instance <br />
| BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); <br />
return mi;<br />
}<br />
}<br />
Can anyone tell me as why the GetType().GetMethod() not returning the methodinfo object. It always return null.
Thanks in advance for any kind of help
Regards,
Kais
|
|
|
|
|
Because you have to use GetProperty() method to retrieve a property.
Best regards,
-----------
Igor Sukhovhttp://sukhov.net
|
|
|
|
|
Igor,
I dont see any such property to reterive the get datagrid rows collection.
Is there any alternate way to reterive that.
Regards,
Kais
|
|
|
|
|
First, what is the type of your datagrid ? Are you absolutely sure that this particular datagrid class have a method with the "get_DataGridRows" name ?
Best regards,
-----------
Igor Sukhovhttp://sukhov.net
|
|
|
|
|
Hi ,
Am using windows form datagrid. The datagrid class has a private method named get_DataGridRows. This method will hold the DataRow collection of the datagrid. Since am inheriting the Datagrid class am not able to access this method. If i use it directly am able to access it.
Regards,
Kais
|
|
|
|
|
Windows Forms datagrid do have internal DataGridRows property and get_DataGridRows method is the get accessor for this property.
It's recomended to retrieve property value by obtaining a PropertyInfo object first and calling GetValue method on that object.
Best regards,
-----------
Igor Sukhovhttp://sukhov.net
|
|
|
|
|
Hi......
Can anyone please tell me how to get a handle to a window outside the C# running application? if i drag and drop an icon on a window outside an application, how do i get its handle? anyone..please help me. i'm in a fix...
Thank You...
SB
|
|
|
|
|
You must use Win32API to do that. Probably this is the right function:
http://www.pinvoke.net/default.aspx/user32/GetWindow.html
|
|
|
|