|
Does anyone of you can tell why the following code:
private void HandleKeyPress(object sender, KeyPressEventArgs e)<br />
{<br />
char c = e.KeyChar;<br />
<br />
if(c == (short)Keys.Back)<br />
{<br />
e.Handled = true;<br />
SendKeys.Send("{LEFT}");<br />
return;<br />
}<br />
}
works in common textBox but it doesn`t work in richTextBox?
In textBox line e.Handled = true; stops the backspace key action and only action after pressing bakcspace key is move the cursor to left (SendKeys.Send("{LEFT}"); ).
In richTextBox it`s taken double action. e.Handled = true; code doesn`t block backspace key action so:
1) first it deletes character (backspace key do it - it isn`t block)
2) second it moves the cursor to left (like SendKeys.Send("{LEFT}"); code do)
Can anyone figure out what`s wrong with it?
|
|
|
|
|
Try this
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode.Equals(Keys.Back))
{
e.SuppressKeyPress = true;
SendKeys.Send("{LEFT}");
return;
}
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode.Equals(Keys.Back))
{
e.SuppressKeyPress = true;
SendKeys.Send("{LEFT}");
return;
}
}
|
|
|
|
|
It`s working
Thank you very much
But code
e.SuppressKeyPress = true; I turned into e.Handled = true;
-- modified at 9:50 Friday 17th March, 2006
|
|
|
|
|
Hello!
how can i show and hide a Quick Launch Toolbar or Desktop Toolbar (which are present in the TaskBar Context Menu --> ToolBar) using C# application.
|
|
|
|
|
Hello!
I have wrote a code in which i m trying to hide the Notification icon when i click on the context menu (which pops on that icon). BUt in this manner two events fire. One which is my event written in the code(which works according to my requirement) and other is the Windows own event, which is Taskbar Popup menu. which always seems bad. if i call any messagebox after that fired events, the windows event hide but i don't want to show message box. Please help me.
|
|
|
|
|
Hi,
Sorry to disappoint you, but i wanted to ask my own question in this.
Are you able to detect when the user is clicking on the window in the taskbar?
Actually, i have made a program in which i have made the FormBorderStyle as None. This prevents the system menu to appear when i click on the window in the taskbar.
So, i wanted to figure out a way in which i could detect a click on the taskbar window and display the menu manually.
Please let me know, if you happen to know about this.
Thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
|
I think, i am getting your problem.
See, when you pop-up the message box, the event is still being fired and it still shows the taskbar menu too, but the message box removes the focus and hence makes the taskbar menu disappear.
Secondly, the fact that the taskbar menu is appearing shows that you are able to hide the icon successfully, but somehow another event is being generated which is being sent again.
I am not sure about how this is happening, but i guess, you can refer to this article[^] for more details.
Also, i hope, you are using the NotifyIcon control. It saves a lot of time.
I hope this helps.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Hello!
I have wrote a code in which i m trying to hide the Notification icon when i click on the context menu (which pops on that icon). BUt in this manner two events fire. One which is my event written in the code(which works according to my requirement) and other is the Windows own event, which is Taskbar Popup menu. which always seems bad. if i call any messagebox after that fired events, the windows event hide but i don't want to show message box. Please help me.
|
|
|
|
|
I want to know my opened ports in my local machine.How can i identify the opened port numbers with out using my ip address.If i use my IP address to
get the ports,it will make port scanning.I can't use port scanning concept.
If u know any other concept related to this Pleas Repaly fastttttttttt
Deepthi
Deepthi
|
|
|
|
|
I think this will solve your problem :
try {
int port = FindUnusedPort(IPAdress.Any);
}
catch (SocketException) {
// no free ports
}
...
using System;
using System.Net;
using System.Net.Sockets;
...
public int FindUnusedPort(IPAddress localAddr) {
for (int p = 1024; p <= IPEndPoint.MaxPort; p++) {
Socket s = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
try {
s.Bind(new IPEndPoint(localAddr, p));
s.Close();
return p;
}
catch (SocketException ex) {
// EADDRINUSE?
if (ex.ErrorCode == 10048)
continue;
else
throw;
}
}
throw new SocketException(10048);
}
Cheers
JIjo
|
|
|
|
|
|
I want help in opennig only one child file at a time. My application irritates me when there are too many child forms open.
I added this code (on all the menu items) to open only one, but the problem is that, I can't open another child while there is a child active. How do you control that ?
Interfaces - Is the folder Name where all forms are located
frmPerson - is the child form (requered form to open)
private void mnuManagePerson_Click(object sender, System.EventArgs e)
{
if (Interfaces.frmPerson.ActiveForm.ActiveMdiChild == null)
{
Form frmchildfrmPerson=new Interfaces.frmPerson();
frmchildfrmPerson.MdiParent = this;
frmchildfrmPerson.Show();
}
}
Cool Joe
"Only the best"
South Africa
-- modified at 5:12 Friday 17th March, 2006
|
|
|
|
|
Make the base class of your child form to implement the singleton pattern
|
|
|
|
|
hi all i have a sample code this will solve your problem
take a form and ToolStripMenuItem from vs toolbox
duble click on opentoolstrip and write these code
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
openToolStripMenuItem.Enabled = false;
Form2 frm = new Form2();
frm.MdiParent = this;
frm.FormClosed += new FormClosedEventHandler(frm_FormClosed);
frm.Show();
}
void frm_FormClosed(object sender, FormClosedEventArgs e)
{
openToolStripMenuItem.Enabled = true;
}
|
|
|
|
|
How do i manipulate hashtables in c# ? i could store objects into hastables but i get problem while retrieving them back.
i tried this :
<br />
Dictionary<string, string> openWith = <br />
new Dictionary<string, string>();<br />
[here i intend replace "string" with my own object type]
but it failed,
may be because it failed even when i tried to include this
using System.Collection.Generic;
it says like "are you missing any assembly reference?"
BTW, just like we have vectors in C++, what's the equivalent container in C# ?
VuNic
|
|
|
|
|
Hi
It's System.Collections.Generic for a start.
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
oops , sorry i typed it wrong there.
it is actually System.Collections only.
VuNic
|
|
|
|
|
A potentially dangerous Request.Form value was detected from the client.
I have a webpage using .net 2.0 with
an asp:button Back and
a textbox with text = "<space>"
I've done my research and everything I see says set ValidateRequest="false" in page directive which I did.
There's no problem if I click the browsers back button. But when I click my own asp button BtnBack, the error is produced. Is there something like setting the validation within my own button?
Thanks!
|
|
|
|
|
Hi,
When browser back button is clicked, no new request is sent to browser, I think(unless we expire the page programmatically). Most probably, you have written a Response.Redirect in your asp button click, right? So, the html code gets posted to the server and server generates the error.
You can either call History.Back(or something like that in javascript) in your button click or you can set ValidateRequest = "True"
Regards,
Jim
|
|
|
|
|
A potentially dangerous Request.Form value was detected from the client.
I have a webpage using .net 2.0 with
an asp:button Back and
a textbox with text = "<space>"
I've done my research and everything I see says set ValidateRequest="false" in page directive which I did.
There's no problem if I click the browsers back button. But when I click my own asp button BtnBack, the error is produced. Is there something like setting the validation within my own button?
Thanks!
|
|
|
|
|
I have bound a "Decimal" field to my DataGridView control.I've gotten precision and scale of this column's value but i am in wonder how to get these values declared in SQL for this field?
Thanks and waiting for your replies ...
|
|
|
|
|
select numeric_precision, numeric_scale
from information_schema.columns
where table_catalog = 'MyDatabaseName'
and table_name = 'MyTableName'
and column_name = 'MyColumnName'
|
|
|
|
|
Hi there,
I have an urgent need for help. I'm currently on a project where I'm developing an Indigo service
(CTP Feb 2006) which is hosted in IIS 6.0 on a Windows 2003 server. This service needs to access a COM component.
First, I tried registering it on the server (regsvr32) and accessing it, but I always get E_NOINTERFACE.
Second I tried to isolate the component and deploy it with a manifest.
But it still doesn't work. I get another COM error (Sorry, don't remeber the actual number but it was something like 80040154).
Now I actually have two questions:
1. Can anyone tell me what I'm doing wrong, and
2. Does anyone know if the isolation of COM components is possible on W2K3 server.
Many thanks in advance
|
|
|
|
|
Good day to all,
Currently im developing an administrative tool that allows me to monitor all workstation under my domain. I want to do remote shutdown/restart/log-off using C#. At first I was thinking of executing the ff:
shutdown -r -f -m \\pcname -t 0 for restart..
shutdown -s -f -m \\pcname -t 0 for shutdown..
I planned to execute it under C# Process & ProcessStartInfo however i feel i doesnt much have control because whenever i shutdown/restart an offline pc, if it is on command line, then it will just hang-up or just a cursor blinking and will not exit the command (maybe it would take too long..). I hope somebody could help me find a way to execute shutdown/restart/log-off remotely which we have better control and more reliable way. Also also want to get remotely,the processes that runs under the client machine/workstation, i hope this is feasible in C#.
Im using .NET 2003 environment,
thanks a lot,
-- modified at 2:39 Friday 17th March, 2006
|
|
|
|