|
Or more specifically i want to get rid of the systemsound when the cursor is in a textbox and you hit the enter key, windows will automaticly play a soundeffect according to the soundeffect that is selected as standardsound (see controlpanel -> Sound and Sound devices -> Scroll down to Standard sound option). I suppose this sound can be useful when you want to notify the user, that the enter key is not applicable in a textbox, in my case however the enter key is supposed to work as an alternative to the tabkey. So in this case it's very annoying having to listening to that soundeffect each time.
I can always deselect the sound from the soundsetting dialogue in controlpanel, however this selection will reflect the whole system and remove the sound in all other cases where this sound occurs and that is not my intention, i just want to remove it from my application. Does anyone know how to solve this?
|
|
|
|
|
Not exactly the easiest thing in the programming world:
Read this[^] to understand how system sound notification occurs and (maybe) how to prevent them.
Yes, even I am blogging now!
|
|
|
|
|
I wouldn't go into changing sound events in the host's OS. Best solution is creating an inherited TextBox and overriding the ProcessDialogKey method:
public Class MyTextBox: TextBox
{
...
protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData==Keys.Enter)
{
if (!this.Multiline)
{
ProcessDialogKey(Keys.Tab);
return true;
}
}
return base.ProcessDialogKey (keyData);
}
...
}
This will enable the enter key as a Tab input. I think its what ur looking for. Just add MyTextBoxes to your form instead of normal TextBoxes and ur all set.
|
|
|
|
|
That is beautiful Skynryd, that really solved my problem.
Thanks a lot
Regards
Hmitosh
|
|
|
|
|
Welcome
|
|
|
|
|
Hello,
I have the following query below that l want executed using crystall reports from the form by clicking on a button.
In VB 6 this was very easy to do with the datareport as you could execute any type of query on the form and display it in the datareport. But l am not sure how to do this in crystall report.
Is there anyway to write this query behind a command button and pass it to the crystall report. I hope you understand what l mean.
string queryOverdueBooks = @"SELECT RefNumber, Title, DateOut, DateDue
FROM Book
WHERE DateDue < '" + currentDate +"' ";
Many thanks in advance,
Steve
|
|
|
|
|
I am hoping to use #Develop to write some C# code but am struggling to get started. Where can I get information on things like "Windows Forms & Properties" - ie Syntax, Use, Descriptions and Modifiers?
Are there other such references that I will need to be aware of (and if so where do I find them) - eg Graphics, File Handling, etc.
My programming experience to date has been Fortran, Pascal, Basic some C and some Assembler - this is my first foray into the realm of IDE and C#
Any advice/help/pointers would be gratefully appreciated.
Many Thanks,
NagaJim
|
|
|
|
|
|
Hello,
I'm a c#.NET developer and I want to have a toolbar control in my application that has a transparented background. Can I do it? I know that the toolbar doesn't support the transparented BackColor property. Is there another way to do it?
Thanks
|
|
|
|
|
Maybe you can try creating a custom toolbox control using group boxes or panels. Both support transparency.
|
|
|
|
|
I think it will be to complicated, no? Isn't there a better way? Maybe there's a free control that I can download that will do it for me?
Thanks lj_rules for you answer - I really appreciate this
|
|
|
|
|
Hello,
I am using a datetime variable. But l want to change the format of the shortdatestring from mm/dd/yyyy to the new format of dd/mm/yyyy.
I used the code below using, using System.Globalization. However, it won't change to this new format of dd/mm/yyyy
DateTime today = Convert.ToDateTime(DateTime.Today.ToShortDateString());<br />
DateTimeFormatInfo dateFormat = new DateTimeFormatInfo();<br />
dateFormat.ShortDatePattern = "dd/mm/yyyy";<br />
today.ToString(dateFormat);
Can anyone help with this.
Many thanks in advance,
Steve
|
|
|
|
|
Here is how is goes:
DateTime today = DateTime.Today;
MessageBox.Show(today.ToString("dd/MM/yyyy"));
Regards.
|
|
|
|
|
I have created a class that inherits from ListView and a class that inherits ListViewItem and implements IComparable. If I put the items in an ArrayList and Sort the items are sorted correctly, but when i try to use Sort in the ListView it doesnt do anything. I´ve tryied invoking the sort part in the listview but no that doesnt work. I do not want to create a class for the sorting part so i thought that IComparable only on the objects in the collection would allow me not to modify the collection. Is there something im missing???
|
|
|
|
|
ListView needs an IComparer to be assigned to the ListViewItemSorter property, for the sorting work.
Read the help on the Sort property on MSDN for a sample, if your class already implements IComparable, you can simply delegate it to the CompareTo() method, and code the IComparer with one line of code only.
And that, IMO is a design mistake, and should be done by the ListView by default.
Yes, even I am blogging now!
|
|
|
|
|
I had a problem earlier about constructing sockets in win2k, that I managed to resolve. However, further down the code, I suffered from an additional problem with Permission Exceptions. I have the following error message (It's a bigun!):
System.Security.SecurityException: Request for the permission of type System.Net.SocketPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=<token> failed.
at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet grantedSet, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames, Int32 unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.Net.Sockets.Socket.CheckCacheRemote(SocketAddress socketAddress, EndPoint remoteEP, Boolean isOverwrite)
at System.Net.Sockets.Socket.SendTo(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint remoteEP)
at System.Net.Sockets.Socket.SendTo(Byte[] buffer, Int32 size, SocketFlags socketFlags, EndPoint remoteEP)
at Ping_Library.Ping.PingHost(String host) in \\<file location="">:line 197
I tried adding unrestricted socket permission to it using the following line:
<br />
SocketPermission se = new SocketPermission(<br />
System.Security.Permissions.PermissionState.Unrestricted);<br />
This failed to fix the issue. Does anyone know how to resolve this?
Cheers
Tris
|
|
|
|
|
Lets say I have following event handler
private void PrintDocument_PrintPage(Object sender, PrintPageEventArgs e)
{
/// some code
}
If I open a watch window on "sender" or on "e", some of the items in watch window get duplicated, like;
"defaultPageSettings" and "DefaultPageSettings"
or
"DocumentName" and "documentName" , etc;
except the first letter's case they have everything common.
What is the reason to provide the same data twice? There must be some...
Please guide.
|
|
|
|
|
Those are duplicates. One is the private field and the other is the public or protected property that exposes the field. Notice the difference in case? The .NET Framework is case-sensitive (despite what you hear about VB.NET, in which case it's only "case-insensitive" because the source editor corrects the case for you at design-time).
Fields should never be exposed publicly, except perhaps for constant values. One common naming convention is for the private fields to use a lower-case letter in the first position while the property that reflects it uses the upper-case notation that is a guideline in the .NET Framework (unlike Java, in which case all members start with a lower-case letter; consistency is very important in Rapid Application Development (RAD) environments).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi ALL.
Is there any legal or technical limitations in publishing .Net Beta 2.0 applications?
Yaakov
|
|
|
|
|
There is a license.txt file in the SDKs after you download and install them. The best way to understand the legal limitations is to read them or have a lawyer read them.
As far as technical limitations, there really aren't any more than any other language. ".NET" is actually Microsoft's implementation of the Common Language Infrastructure (CLI), and only runs on Microsoft Windows platforms (except 9x, which is not supported any more). There are other CLI implementations for other platforms, including Mono, Portable.NET, and dotGNU.
When you use a full-featured language that targets the CLR (Common Language Runtime) like C# (written from the ground-up for .NET and it is an ECMA standard, unlike other languages *cough* VB.NET) there really isn't much you can't do. C# and other managed languages let you call native functions. C# also allows you to use unsafe code (i.e., direct memory addressing and pointer math with pinned memory).
Once again, the best way to understand the limitations is to read. In this case, be sure to read through the .NET Framework SDK, which is installed by default with VS.NET, available separately as an SDK install, and available online at http://msdn.microsoft.com/library[^]. For 2.0 beta, you'll want to visit http://msdn2.microsoft.com/library[^]. I'll warn you that a lot is not documented publicly yet so the latter reference may not be a lot of help.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks for your detailed answer.
Yaakov
|
|
|
|
|
How do you create a stand alone static enum (I guess class) that can be accessed through it's Namespace. Like for instance....
Like in the Namespace System.Data the enums
ConnectionState
CommandType
DataRowAction
In these instances when I want to check a connection's state I compare my connection object's State property to (With no using statement) System.Data.ConnectionState.Open
How do I create a custom enum class inside by Namepsace that I can reference directly without having to reference through a created object?
Thanks for the help!
Trevor Ledet Newbie.
|
|
|
|
|
I'm not sure I understand what you're asking, but you don't have to reference an enum through an object: in fact, System.Data.ConnectionState.Open includes no objects - only the namespace (System.Data ), then the enum (ConnectionState ), and finally the enum member (Open ). It isn't like many C/C++ enums that are just #defines.
You declare an enum like so:
public enum MyEnum
{
One,
Two,
Three
} You can also assign specific values to each. If you want to use a flagged enumeration (so you can use bitwise operators on the enum members), attribute it with the FlagsAttribute and - to following naming guidelines to be consistent with the base class library (BCL) - make the enum plural:
[Flags]
public enum MyEnums
{
One = 1,
Two = 2,
Four = 4
} For more information about this, I highly suggest you read about the Visual C# Language[^], especially the Visual C# Language Specification[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I did not realize I could declare a enum in the namespace outside any class being defined in the namespace. But it works.
Thanks for the help.
|
|
|
|
|
hello i am having tons of trouble moving a child window where i want if the user click within that child i want to keep the cursor at the same location on the child however i want to be able to drag the child around basicly i want to keep the mouse at the same position on the child and be able to move the child relative to the form
here is the code im working with
<br />
private void gripper1_Click(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
dragging = true;<br />
this.Dock = System.Windows.Forms.DockStyle.None;<br />
<br />
Point p1, p2;<br />
p1 = PointToClient(new Point(e.X, e.Y));<br />
p2 = PointToClient(Location);<br />
diff = new Point(p2.X + p1.X, p2.Y+p1.Y);<br />
}<br />
<br />
private void gripper1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
if(dragging)<br />
{<br />
this.Location = PointToScreen(new Point(e.X + diff.X, e.Y + diff.Y));<br />
}<br />
}<br />
i have tried every combination of adding and subtracting and PointToScreen and PointToClient
however none work this is the closest it sometimes keeps the pointer within the child but it seems inconsistant please help this is my 3rd post and none of the solutions that have been offered actualy work. PLEASE PLEASE PLEASE HELP ME!
|
|
|
|
|