|
Whats an IDE method?
Either 2.0 or 3.0 ( idk which ) has a method for adding additional methods to a class. If you do a web search for new features of the two it can direct you. If those are not available the pattern is a wrapper class.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Im using .net 2.0. googling around still haven't found anything yet.
Donkaiser
|
|
|
|
|
Its extension methods and I think it is in 3 only. Looks like you need a wrapper class.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Yeah, I don't think it's possible to overload a native method. and the only solution is to do a wrapper.
Donkaiser
|
|
|
|
|
Hi,
I was hoping if someone could help me with this problem. I want to edit
datagrid entries without using a linkbutton column for edit and update.
maybe we could do this using javascript. But I dont know how?
On an 'edit settings' button click outside the datagrid, the cells in the datagrid should change into dropdownlists and textboxes with earlier values maintained.
Thanks!
Monisha
-- modified at 10:50 Thursday 27th July, 2006
|
|
|
|
|
In VS 2005 you can do edits in-place within the grid. You only need to have an 'Edit' trigger if you want to open up a seperate view of the record.
|
|
|
|
|
I am using the Socket class to communicate between two applications and if I close my server app closing the socket connections my client app is unable to detect that it is closed. Even doing a send from the client app does not throw an exception. Does anyone know how to detect if a socket has been closed from the other side?
Thanks
Kurt
|
|
|
|
|
What does the Connected property read as when you do this? Is there a timeout issue, i.e. you haven't waited long enough for the timeout to kick in and say the connection has been closed?
only two letters away from being an asset
|
|
|
|
|
Connected property is true. Even tried waiting a few minutes. Using asynchronous methods which do not use a timeout I believe.
|
|
|
|
|
i want to catch any key down event in my windows form.
but it doesn't run, because there is maybe an other control in the formular that is focused, so the key down event reacts only on that inner control.
how can i catch any keydown event without referencing each control in the formular to the keydown event?
another method i know is to create a menustrip and give them shortcuts (but i think it's not the perfect solution)
_______________________
where is the "any" key?
-- modified at 7:11 Wednesday 9th August, 2006
|
|
|
|
|
Do you want catch just any key down
or only key down when one of the child controls of your form (or the form itself) is focused?
|
|
|
|
|
any key down
not specially to a control in the form
|
|
|
|
|
You have to install windows hook procedure to intercept all keyboard events.
Look at “How can I use 'Hooks' in .NET” article at following link
http://72.14.203.104/search?q=cache:NUhXDPTnLJgJ:www.syncfusion.com/FAQ/WindowsForms/FAQ_c70c.aspx+%22DllImport%22+SetWindowsHookEx+WH_KEYBOARD+C%23&hl=en&gl=ca&ct=clnk&cd=1
|
|
|
|
|
You can read about windows hooks in .Net here <a href="http://msdn.microsoft.com/msdnmag/issues/02/10/CuttingEdge/">http://msdn.microsoft.com/msdnmag/issues/02/10/CuttingEdge/</a>[<a href="http://msdn.microsoft.com/msdnmag/issues/02/10/CuttingEdge/" target="_blank" title="New Window">^</a>]
Use WH_KEYBOARD when installing the hook procedure with SetWindowsHookEx
Use following code to detect key down in your hook
static readonly int WM_KEYDOWN = 256,
public Int32 KeyboardProc(int code, Int32 wParam, Int32 lParam)
{
if ((Int32)wParam == (Int32)WM_KEYDOWN )
{
// do processing
}
// do not forget to call next hook !!!!!!!!!!!!
// CallNextHookEx is win32 api that can be loaded to .Net
// using dll import like they did with setwindowshookex in example
return CallNextHookEx(hHook, code, wParam, lParam);
}
|
|
|
|
|
Try setting the form's keypreview to true, then catch the key down of the form.
|
|
|
|
|
It will work only if the the form captured the input.
As far as I unerstand the goal is to catch all keyborad key downs regardless to the current window.
|
|
|
|
|
i want to catch all keyboard key downs which were sendet if any control in the current window is focused (without catching each key down of each control in the window.)
|
|
|
|
|
i setted the keydownpreview true of the form and create a keydownpreview_event of the form, but the event does not trigger.
|
|
|
|
|
Hi.i want to craete a class that will read data from database and display it on the texboxes.but it can not display it.so i did this
try
{
SqlCommand cmdSearch = new SqlCommand();
cmdSearch.Connection = conn;
cmdSearch.CommandText = "SELECT Name,Surname FROM Users WHERE UserName =@UserName";
SqlParameter Nam = new SqlParameter();
Nam.ParameterName = "@Name";
Nam.Direction = System.Data.ParameterDirection.Output;
Nam.Value = Name;
cmdSearch.Parameters.Add(Nam);
SqlParameter Sur = new SqlParameter();
Sur.ParameterName="@Surname";
Sur.Direction = System.Data.ParameterDirection.Output;
Sur.Value = Surname;
cmdSearch.Parameters.Add(Sur);
SqlParameter Use = new SqlParameter("@UserName",System.Data.SqlDbType.VarChar,50,UserName);
Use.Value = UserName;
cmdSearch.Parameters.Add(Use);
SqlParameter Lev = new SqlParameter();
Lev.ParameterName="@Level";
Lev.Direction = System.Data.ParameterDirection.Output;
Lev.Value = Surname;
cmdSearch.Parameters.Add(Lev);
SqlDataReader dr =cmdSearch.ExecuteReader();
if(dr.Read() == true)
{
MessageBox.Show("Record found");
}
else
{
MessageBox.Show("Record not found");
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
|
|
|
|
|
A question ends with a ?
BTW, never, ever, never ever, do if(dr.Read() == true) unless it is just a typo.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: BTW, never, ever, never ever, do if(dr.Read() == true) unless it is just a typo.
Personally, I hate this syntax would use if(dr.Read()) - im interested why you think this should "never ever" be done though
|
|
|
|
|
Because you will get flamed by coworkers
Really it doesn't bother me too mucb but everyone else around here seems to pitch a fit about it. Of course, with a data reader it should be while(dr.Read()) :p as well
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: it should be while(dr.Read()) :p as well
Only if you expect the datareader to have more than 1 row. If I wanted to ensure that I only ever read the first row, then if(dr.Read()) would be a necessity!
|
|
|
|
|
If you are using if(dr.Read()) to ensure only one row your query is bad.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
hi all,
i have a datagridview with 2 columns. (1 is readonly and the other can be edited)
i want to restrict users just to type characters from 0 to 9 and . (dot).
how can i check this during editing ?
in which event should i place this code:
Regex regex = new Regex("^[0-9-.]*$");
if (regex.IsMatch(txtprice.Text))
{
// Type is Correct!
}
ps: and this code is a textbox's check. how should write selectedcell index instead of txtprice.Text ?
thanks in advance,
bye.
|
|
|
|