|
Hi All,
I've set my ToolStrip's Text property [1]. However, .Net 2.0 refuses to display it. Any ideas on how to get this control to disply the text? As usual, the documentation does not mention the property is not honored, or offer a work around...
Jeff
[1] ToolStrip Properties[^]
|
|
|
|
|
Please set DisplayStyle= ImageAndText
Also you can right click on tool strip and add a label to it and then set text to that label.
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
I work on a class that handles the a tcp-connection but now i discovered a problem with my data-handling and cant solve it =/
First some Informations:
The Socket-class provides the Async-Methodes BeginReceive and EndReceive to receive the data over the socket.
When i call BeginReceive then another Methode will automatically raise.
connSocket.BeginReceive( mainBuffer_, 0, mainBuffer_.Length, SocketFlags.None, out socketError_, new AsyncCallback( receivedata ), connSocket ); In this case the methode "receivedata" will raise when data are available. In this methode "receivedata" do i fetch the data from the socket and save it a Queue, after that i start a second thread wich process the data from the queue.
private SocketError socketError;
private volatile byte[] mainBuffer;
private volatile int receivedDataSize;
private volatile Thread processingThread;
private volatile AutoResetEvent autoResetEvent;
private volatile Queue<List<byte>> receivedDataQueue;
...
private void receiveData( IAsyncResult aSyncResult ) {
try {
Socket connSocket = ( Socket ) aSyncResult.AsyncState;
receivedDataSize = connSocket.EndReceive( aSyncResult, out socketFehler_ );
if( receivedDataSize > 0 ) {
if( receivedDataSize != connSocket_.ReceiveBufferSize ) {
byte[] tmpBuffer = new byte[ receivedDataSize ];
Array.Copy( mainBuffer, tmpBuffer, receivedDataSize );
receivedDataQueue.Enqueue( new List<byte>( tmpEingangsPuffer ) );
}
else {
receivedDataQueue.Enqueue( new List<byte>( mainBuffer ) );
}
if( ( socketClosed == false ) &&
( ( processingThread == null ) || ( processingThread.IsAlive == false ) ) ) {
processingThread = new Thread( new ThreadStart( empfangsDatenVerarbeitung_ThreadMethode ) );
processingThread.IsBackground = true;
processingThread.Start();
}
autoResetEvent_.Set();
}
else {
closeConnection();
}
if( socketClosed == false ) {
Array.Clear( mainBuffer, 0, mainBuffer.Length );
connSocket.BeginReceive( mainBuffer, 0, mainBuffer.Length, SocketFlags.None, out socketFehler_, new AsyncCallback( receiveData ), connSocket );
}
}
catch( SocketException ) {
closeConnection();
}
catch( ThreadStateException ) {
closeConnection();
}
catch( ObjectDisposedException ) { } The second thread execute the following Methode
private void empfangsDatenVerarbeitung_ThreadMethode() {
while( socketClosed == false ) {
if( receivedDataQueue.Count > 0 ) {
while( receivedDataQueue.Count != 0 ) {
}
}
autoResetEvent_.WaitOne();
} -------------------------------------------------------
OK, it looks fine but the method "receiveData" wich should be raised automatically when data are available doesnt raise everytime. After a minute it starts to stuck =/...my question is now...
Is there something that i do wrong with the threading ?
|
|
|
|
|
i'm not sure, but i think that Thread.IsAlive is a bit dangerous...
msdn says about Thread.IsAlive : "true if this thread has been started and has not terminated normally or aborted otherwise false" so if an exception comes up in your dataprocessing you have a autoResetEvent that signals something and nobody listening.
-- modified at 5:01 Thursday 29th November, 2007
never mind.. Thread.IsAlive does exactliy what it should
you could put the stuff into a console application and do some Console.WriteLines to find out where it actually stops working..
|
|
|
|
|
Hello,
I wish to incorporate some assembly security attributes to my class library. So I add something like this to my class library namespace:
[assembly:System.Net.SocketPermission(SecurityAction.RequestMinimum)]
namespace olapWeb_Controls
{
So on and so forth. Yet I have many classes in my class library - all of them reference the namespace. Apparently I can add permission by simple adding the directives to just one of the classes - but I would rather I added them one central place, rather than in just one class (which might get changed by someone else than me). Adding the same permissions to every single class seems like overkill. What should my best practice be?
Many thanks,
Morten,
Denmark
|
|
|
|
|
How I can add a new created data row in data table...?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
datatablename.Rows.Add(colone,coltow,colthree,......);
Thaer
|
|
|
|
|
Thx for reply.
Suppose I have 10 columns and I want to pass only three values then what to do.?
Also how to manage the identity column of the table....?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
Where to pass column name and data type..?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
DataColumn col = table.Columns.Add();
col.ColumnName = "name";
col.DataType = type;
DataRow row = datatablename.NewRow();
row["columnname"] = value;
|
|
|
|
|
|
hi all
i build activex control by using C#.Net but i wount to preview any KeyDown on any control in new control .
the new control is 2 control is the label and textbox ,
i wount to preview any key down on textbox or on label i means any way key is down on any control on my new control .
how i can have any key is down on this control
thank for any body hellp me
Thaer
|
|
|
|
|
Hello together,
is it possible to display into a DataGridViewImageColumn different pictures, for different rows?
I tried it already this way:
looping on each row, getting the DataGridViewImageCell and set the Value-Property to a
new System.Drawing.Bitmap
But it don't work
Thanks for help
|
|
|
|
|
yes you can add columns by datatype image
go to edit columns to thr datagridview and add new column by type DataGridViewImageColumn
welcom mr
Thaer
|
|
|
|
|
Sorry, i think you missunderstand my question.
i need an ImageColumn and in this column, the rows have different images.
For example
Row 1 has a "doc.jpg"
Row 2 has a "mail.jpg"
Row 3 has a "fax.jpg"
Row 4 has a "mail.jpg"
But thanks for help
|
|
|
|
|
Use this
Icon treeIcon = new Icon(Path + "Images\\History.ico");
DataGridViewImageColumn iconColumn = new DataGridViewImageColumn();
iconColumn.Image = treeIcon.ToBitmap();
iconColumn.Name = "ColHistory";
iconColumn.HeaderText = "History";
DataGridView1.Columns.Insert(12, iconColumn);
//Where 12 is location of column number
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
Hello Everyone,
Can anybody let me know how to run the CSharp program in Dos window of .NET Framework
|
|
|
|
|
what do you mean by CSharp Program?????
Nothing is Impossible. Even impossible spells "i m possible"
|
|
|
|
|
Do you mean a Console Project?
|
|
|
|
|
Helloooooooooooooooooooo
Yes i mean a console app.
|
|
|
|
|
Hi
In the properties of your project there's an option called "output type" (or something like that..) set it to console application and it will open in a console window.
|
|
|
|
|
If u are using IDE to develop application then, while selecting a new project you can choose the project type. Select a console project type.
If the post/article served your purpose then, please assist me in keeping it up by donating a small amount of money to my Paypal account. Email: sreejithssnair@hotmail.com
|
|
|
|
|
Open a DOS box and run it.
|
|
|
|
|
Hi I've created a Custom Control "YoLabel" with
<br />
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);<br />
and drawing it inside OnPaint(...) method. The Control draws itself fine.
Now I need to paint something more from outside the label such as
<br />
YoLabel lbl = new YoLabel();<br />
lbl.Paint += delegate(object s, PaintEventArgs)<br />
{<br />
};<br />
Now the above Event Handler is not firing. Inside YoLabel Control I'm using invalidate whenever Text, Color, etc properties are changed to repaint it.
So what is missing. Please Advice.
Thanks...
|
|
|
|
|
do you call base.OnPaint in your override of OnPaint? the Paint - Event is fired from there.
|
|
|
|