|
I set the SocketOptionName.SendTimeout and SocketOptionName.ReceiveTimeout, but it didn't affect the Connnect timeout.
Brian
|
|
|
|
|
Hi, all!
How can I crate TextBox which would display 'circles' instead of '*' in WinXP?
Currently I have TextBox with PasswordChar set to '*' because of I do not know how else I can say that this is a PasswordBox.
I enabled Visual Styles through manifest but it still shows '*'
Thanks.
Regards,
alexx.
|
|
|
|
|
you can use the dot character (copy and paste one of these)
• ( U+0222 arial)
● ( U+25CF times new roman)
or any other character in the Windows' CharactersMap (unicode section)
|
|
|
|
|
Hello, Claudio!
But in that case I'll got the same char in Win2k and I do not want to.
Thanks.
Regards,
alexx
|
|
|
|
|
if you want to display the normal asterisk character in a Windows System < win2K
you can use this:
<br />
if ((Environment.OSVersion.Version.Major >= 5) || ( (Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major == 4) ))<br />
{<br />
textBox1.PasswordChar= '•';
}<br />
bye
|
|
|
|
|
Look for TextBox.PasswordChar property. You have to set this property.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
|
A simpler way is to set the PasswordChar property. This re-creates the handle of the TextBox with the ES_PASSWORD style.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi, all!
I have several controls, bounded to public properties of my Settings class. Those are edit boxes, check boxes and combo. MSDN says that in this case bounded property is updated immedeatly when control's text changes, but I have update is done only after control looases focus...
What is wrong? I want to track changes to Enable Apply button on my form after user changes one of the controls text.
Thanks.
Regards,
alexx.
|
|
|
|
|
The control's text isn't changed until the control looses focus. Up until then, you're merely filling the UI with data. The text isn't committed to the appropriate property until it looses focus. To see this, handle the TextChanged event, for example. Things like check boxes are set immediatley, though, because it requires a simple action (a click).
If you want to get an order of events that happen, see the GotFocus Event[^] documentation in the .NET Framework SDK, for example.
You'll also notice this behavior in Windows in some places, too. If you want to change it, you could assume that any change to a TextBox (for example) will change the data (even though they might undo their changes). There's many ways you could handle this solution. For instance, handle the KeyUp event (handling this as opposed to KeyDown at least lets savvy users press Esc before letting up to cancel the current character) and enabling your Apply button in the handler. You could, in this case, simply point all TextBox es to the same handler as well.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello, Heath!
Thanks in advance!
I want to get TextBoxes to function as for example CheckBoxes : immedeatly apply Text changes to bounded property. Example of that You can see in VS Project Properties dialog : if I change any setting in the Property Grid and then move mouse on to Apply button which is not enabled yet and then press mouse button this ENABLES Apply button but not clicks on it and when You do second press it clicks button. How can I do that? When I clicking on my Apply button which is Disabled currently edited textbox does not loose focus! How can I catch that user is going to stil focus from currently focused control? In VS when I press mouse button first time Apply button is enabled but focus is still in property grid
Thanks
|
|
|
|
|
Again, that's a focus issue. When you attempt to set the focus to a button (even though it doesn't gain focus since it is currently disable) the TextBox looses the focus which commits the text and then the TextChanged event is fired. Again, if you want the Apply button be enabled upon making any change regardless of focus, you need to handle one of a couple different of events (like KeyUp ) or override several methods (like OnKeyUp ) in a derived class.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi
anyone know any good tool for reformatting c# code.
and by reformat i mean move all public methods to one place , all public propps to another etc etc.
//Roger
(i saw an addin/macro that did that once but i forgot the name)
|
|
|
|
|
|
Hi Guys,
I was able to create a program which will run 3 process at the same time using threads but the criteria or paramaters that I used is HARDCODED (IP ADDRESS/PORT). Now I need to create the same program using threads but the only difference is that IP/PORT is coming from the table and I need to pass it from the class one at a time.
Please somebody help me I'm not good in CLASS, i'm trap with this thing, this is the only one left....
dabuskol
|
|
|
|
|
Just create a class to from which the thread is started that hold these values like so:
using System;
using System.Threading;
public class MyClass
{
public string s1, s2, s3;
public MyClass(string s1, string s2, string s3)
{
this.s1 = s1;
this.s2 = s2;
this.s3 = s3;
}
public void Start()
{
new Thread(new ThreadStart(StartInternal)).Start();
}
private void StartInternal()
{
}
} This is a VERY basic example, but should hopefully give you one idea.
Another way is to pass arguments to the thread. The Thread class isn't capable, but ThreadPool.QueueUserWorkItem is:
object[] parms = new object[] {"Test", 1, Color.Red};
ThreadPool.QueueUserWorkItem(new WaitCallback(SomeMethod), parms); If you want more ideas, click "Search comments" above because we've discussed this many times in the past. You should also read about Threading[^] in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Guys,
Thank You very much.
my problem right now is that when I run my program it gave this error message:
"THE I/O Operation has been aborted because of either a thread exit or an application request"
Here is the code where the took place.
public void OnDataReceived(IAsyncResult asyn)
{
try
{
CSocketPacket theSockId = (CSocketPacket)asyn.AsyncState ;
//end receive...
int iRx = 0 ;
iRx = theSockId.thisSocket.EndReceive (asyn);
char[] chars = new char[iRx + 1];
System.Text.Decoder d = System.Text.Encoding.UTF8.GetDecoder();
int charLen = d.GetChars(theSockId.dataBuffer, 0, iRx, chars, 0);
System.String szData = new System.String(chars);
txtDataRx.Text = txtDataRx.Text + szData;
WaitForData();
}
catch (ObjectDisposedException )
{
System.Diagnostics.Debugger.Log(0,"1","\nOnDataReceived: Socket has been closed\n");
}
catch(SocketException se)
{
MessageBox.Show (se.Message );
}
}
I'm connecting to server(s) and then retrieving data and insert in into my SQL database.
/dabuskol
|
|
|
|
|
Is OnDataReceived the callback for when the asynchronous call completes? If not, you're not waiting for the data to be received, unless somehow that's what WaitForData is doing (but since you're not passing the asynchronous data, I don't see how it could).
For more information and lots of examples on asynchronous programming, see Including Asynchronous Calls[^] in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am building an add in for Visual Studio .NET and I want to programmatically access the “Find Symbol” feature as well as the “Go to Reference” and “Go to Definition” features from my code. Does anyone know how to call those functions from code?
Thanks.
|
|
|
|
|
Does C# have a propertybag object? I guess, better yet would be a question for the most efficient means to store settings at design time for usercontrols? Any and all suggestions are welcome.
Thanks,
Dave
|
|
|
|
|
They're called properties. Any properties on your control are serialized to the code file. Your designer for the control (if you provide one) can also create PropertyDescriptor s that hold the value of design-time variables or expose other aspects of the code (such as the access modifier or localization settings) as properties.
For more information, see Enhancing Design-time Support[^] in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
In my app I have a custom button class that contains an Icon field.
I choose an icon for the button, save this icon in the buttons icon field and set the icon to be displayed on the button. So far everything works great and the icon on the button looks fine.
Now, I want to save the button's icon (along with other info Im using), so I serialize it.
However, when I deserialize the info and create a new button using the deserialized icon, the icons image quality is poor. It looks like its using less colors or something. The same thing happened when I used bitmaps intstead of icons.
I dont have much experience with image manipulation so if anyone knows what could be causing the drop in quality please let me know.
(Is there a way to set the image quality of the deserialized icon to that of windows)?
Thanx
-Flack
|
|
|
|
|
Button button1=new Button();
button1.Parent=this;
button1.Bounds=new Rectangle(20,20,256,256);
button1.Image=new Bitmap(@"C:\Windows\soap bubbles.bmp");
FileStream fs=new FileStream("iconser.bin",FileMode.OpenOrCreate,FileAccess.Write,FileShare.None);
BinaryFormatter bf=new BinaryFormatter();
bf.Serialize(fs,button1.Image);
fs.Flush();
fs.Close();
FileStream fsOut=new FileStream("iconser.bin",FileMode.Open,FileAccess.Read,FileShare.None);
Image img=(Image)bf.Deserialize(fsOut);
Button btn=new Button();
btn.Bounds=new Rectangle(300,20,256,256);
btn.Parent=this;
btn.Image=img;
|
|
|
|
|
I meant, in this example no image quality loss can be observed.
|
|
|
|
|
I have an outlook bar with a bunch of buttons. When you click one of the buttons, it will open a certain program. The only problem that I have is that it opens the program about 20 times. Any ideas?
Here is the code for opening the program:
<br />
private void clickAction(object sender, System.EventArgs e)<br />
{<br />
Process.Start(@"....");<br />
}<br />
Thanks.
By BigBlob202
Dinco Inc.
|
|
|
|