|
Hi,
Is there anyway of differentiating whether a controls Leave event was fired by a "TAB" out of the control or by a "Mouse Move" out of the control. I am trying to pop-up a window whent he user "tabs" out of a control which is fine but it is also happening when they "mouse move" out of the control. I am using the controls Leave event. Any help will be greatly appreciated.
Thanx
Craigo
|
|
|
|
|
I would imagine (although I haven't tried this) you could intecept both the MouseMove and the KeyDown events for your control then in the KeyDown event check for the tab key and if it was pressed set a flag, lets call it TabPressed, to true (else false). In the MouseMove event you would set TabPressed to false. When your control Leave event fires you can then check if TabPressed is true and pop-up your window if it is, else don't.
|
|
|
|
|
Thanx for the reply....the problem is that you cannot trap the Tab key on the KeyDown event becase when you press the tab key it doesnt fire the keydown event, only the OnLeave event fires.
|
|
|
|
|
Hmmm....what if you set the KeyPreview property of the form that contains your control to true and handle the KeyDown event there? Will that let you see the KeyDown before the OnLeave event?
-- modified at 9:47 Tuesday 18th October, 2005
Actually, another thought. Perhaps you could check the mouse position using Cursor.Position in your OnLeave event and check to see if it is within your control or not?
Or better yet (maybe) perhaps you need to handle the MouseEnter and MouseLeave events for your control. Keep a flag (set on the MouseEnter and MouseLeave events) of whether the mouse is within the control. When the control first gets focus store the current state of that flag. On your OnLeave event check to see if the current flag state indicates that the mouse is outside the control where before it was inside. There are some details there that you'd have to work out, but it's something to think about.
|
|
|
|
|
iam doing a project on cryptology in c# i need help in the topic
like what i can are features that i can include and what are the new features in
cryptology please help me out...
MADE BY SANDY
BAD COMPANY
|
|
|
|
|
|
hi thanks for ur help actually my real name is sandeep francis
MADE BY SANDY
BAD COMPANY
|
|
|
|
|
Erm, there's lots of stuff in System.Security.Cryptography[^]. It's unlikely you will learn much about it by adding "using System.Security.Cryptography" to a .cs file though.
Ryan
O fools, awake! The rites you sacred hold
Are but a cheat contrived by men of old,
Who lusted after wealth and gained their lust
And died in baseness—and their law is dust.
al-Ma'arri (973-1057)
|
|
|
|
|
i am try to write tcp client an server but any time it get to the streamReader it hungs.
can someone help me with these code
Client Code
public string RunClient(string address,int port)
{
string response="";
//set up a listener on that address/port
TcpClient tcpClient=new TcpClient(address,port);
if(tcpClient!=null)
{
string message="Hello There";
//translate the message into UTFASCII and store it as a byte array
byte[] bytes=Encoding.ASCII.GetBytes(message);
NetworkStream stream=tcpClient.GetStream();
//send message to the connected tcpServer
//the write flushes the stream automatically here
stream.Write(bytes,0,bytes.Length);
//get the response from the server
StreamReader reader=new StreamReader(stream,Encoding.UTF8);
try
{
response=reader.ReadToEnd();
}
finally
{
//close reader
reader.Close();
}
//close client
tcpClient.Close();
}
//return response to text
return response;
}
Server Code
public static void RunServer(string address,int port)
{
//set up address
IPAddress addr=IPAddress.Parse(address);
//set up listener on that address/port
TcpListener tcpListener=new TcpListener(addr,port);
if(tcpListener !=null)
{
//start it up
tcpListener.Start();
//wait for tcp client to connect
TcpClient tcpClient=tcpListener.AcceptTcpClient();
byte[]bytes=new byte[1024];
//get the client stream
NetworkStream ClientStream=tcpClient.GetStream();
Stream str=ClientStream;
StreamReader reader=new StreamReader(ClientStream,Encoding.UTF8);
try
{
string request=reader.ReadToEnd();
//just send an acknowlegment
bytes=Encoding.UTF8.GetBytes("Thanks for the message");
ClientStream.Write(bytes,0,bytes.Length);
}
finally
{
//close the resder
reader.Close();
}
//stop listeneing
tcpListener.Stop();
}
}
|
|
|
|
|
|
Hi all!!! Sorry for my english!!!
I have one problem. I created the table in WinForms with UltraWinGrid. And I want, for example, merge three(or two cells) in second column, but I don't know how I can do it!
Does somebody know how I can to do it?
Thanks in advance for your help...
|
|
|
|
|
I want to create numeric DataGridViewColumn, so i create a class inherited from DataGridViewTextColumn. but there is no event being overridable.
is there any other way?
i also need DataGridViewDateTimeColumn but i dont know how can i write that
|
|
|
|
|
Why do you want to override an event?
You mainly have to deal with the Edit, Commit, Abort and Paint functions and they are all overridable.
|
|
|
|
|
Is there a way to iterate through resources using the ResourceManager?
I know that there is a way of doing this with the ResourceReader and
IDictionaryEnumerator however the ResourceReader (as far as I know)
only takes ".resources" files.
But obviously the final product will be using assemblies and satellite
assemblies not ".resources" files. So I would have to find a way of
doing it with the ResourceManager…
Is there a way to accomplish this?
|
|
|
|
|
Hi
I want to put automatically a toolbar in the windows deskbar on startup. I saw many articles on Band Objects but in my case i just want to add a classic toolbar (directory or url).
Does somebody know how to do ?
Thanks in advance for your help...
|
|
|
|
|
I search in the registry, but i find nothing...
|
|
|
|
|
C# .NET 1.1
I am using a ADO.NET Dataset containing of 2 tables... The tables are in a master(Table1)->detail(Table2) relationship and I use 2 Odbc Dataadapters (daTable1 and daTable2) to fill and update the tables...
--
MyDataSet dataSet = new MyDataSet ();
daTable1.Fill(dataSet);
daTable2.Fill(dataSet);
--
This works as expected and I use the dataset to change/insert some data.
Now I am trying to update the database with the following code:
--
if (dataSet.Table2.GetChanges(DataRowState.Deleted)!=null)
{
daTable2.Update(dataSet.Table2.GetChanges(DataRowState.Deleted));
}
if (dataSet.Table1.GetChanges(DataRowState.Deleted)!=null)
{
daTable1.Update(dataSet.Table1.GetChanges(DataRowState.Deleted));
}
if (dataSet.Table1.GetChanges(DataRowState.Modified)!=null)
{
daTable1.Update(dataSet.Table1.GetChanges(DataRowState.Modified));
}
if (dataSet.Table2.GetChanges(DataRowState.Modified)!=null)
{
daTable2.Update(dataSet.Table2.GetChanges(DataRowState.Modified));
}
if (dataSet.Table1.GetChanges(DataRowState.Added)!=null)
{
daTable1.Update(dataSet.Table1.GetChanges(DataRowState.Added));
}
if (dataSet.Table2.GetChanges(DataRowState.Added)!=null)
{
daTable2.Update(dataSet.Table2.GetChanges(DataRowState.Added));
}
--
I could do the same with
daTable1.Update(dataSet.Table1)
daTable2.Update(dataSet.Table2)
but I don't want to rely on cascading updates / deletes...
Anyway when both tables are effected I get the following OdbcException when calling the second Update method:
OdbcException ( ERROR [HY007] [Microsoft][ODBC SQL Server Driver]Associated statement is not prepared)
---
I really don't know why this happens and I couldn't find any information on the net.
I would really appreciate any help!
Thanks in advance
Pakl
|
|
|
|
|
You need to specify the update command that the dataApdater should use i.e. the UpdateCommand.
|
|
|
|
|
Thanks...
Yes I know, I forgot to mention that I generate the dataadapters .... and I didn't post the code, because it is very very long. The UpdateCommand is valid. And it works if only one of the tables has changed...
|
|
|
|
|
Hello All.
Please help me!
I have VS.NET 2003 installed and I have problem with it. When I compile project it causes windows crash to BSOD! It fails during the compilation and I get no message. Only, that some application caused problems and windows is immediately halted to prevent system damage.
My HW config:
Intel P4 (2.4GHZ), MainBoard D865PERL, 512MB RAM
DVD LG 4167B,
TV Tuner WinFast TV2000XP expert
I think it can be caused either TV tuner driver or DVD LG. I had tried uninstall DVD-RAM driver and also reinstall VS.NET but without results.
heartfel thanks for any help.
Peter
|
|
|
|
|
|
Hai all,
I am using the ZedGraph Control in my project.
I am drawing a bargraph for srectral responce of a metals.
I want to wary my Bar width dynamically based on the different ranges of the spectral wavelenths that are produced for each metal.
i.e
let us say for metal x if the spectaral peak is at 800 and the range is 50.
Then my bar must spread between 775-825, with center at 800. So for this bar my bar width must be 50 units on the graph.
Please suggest me a solution
Regards
SukanyaVarma
Sukanyavarma
|
|
|
|
|
how can i display a tooltip on each of the items in a listbox when the mouse mover over it?
|
|
|
|
|
You could probably handle the MouseMove event for your control and then work out with item the mouse is over and change the tooltip text for the control based on that. I did something similar with a datagrid.
|
|
|
|
|
I have slight problem. I've pondered over it for quite some time now but I cant seem to figure it out. Here's how it goes -
I have a form on which I have placed button. Now when the button is clicked a function is called which displays another form which has two radio buttons on it and a commandbutton. When the user selected wither of the radiobuttons and then clicks the command button, I want the result of this form to be passsed back to the calling form. In short, I want it to work similar to a dialogbox.
|
|
|
|