|
See this:
http://www.codeproject.com/cs/miscctrl/MessageBoxManager.asp
|
|
|
|
|
in C# Windows,
i have a button and a textbox
when i enter a name in my textbox and click on my button
it saves the name in a Database
i would like my button to work when i press the Return key(Enter)
so dont have to click it.
is there a property for this if not how do can i code this.
hope you understand
thanks
regards paula
|
|
|
|
|
Make the button the default, or 'accept' button in the form.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Or...
use the event "KeyDown" from textbox.
and then just use this:
private void textbox_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Enter)
{
button.PerformClick();
}
}
|
|
|
|
|
if (e.KeyChar == 13)<br />
{<br />
Button1_Click(sender,e);<br />
}
|
|
|
|
|
Hi,
Is there any possibilities to create DataSet/DataTable from ListView Control with out doing looping and reading individual cells. If so please give me an example.
Thanks....
|
|
|
|
|
Not that I know of.
Are you doing this for a one-off or lots of times. If for a one-off just do the looping. If not then if you must use a dataset have a rethink of your architecture.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
I need to read all the items. So using loop is not good idea thats why i'm looking to convert entire ListView into DataSet. Can any one help out.
|
|
|
|
|
I understand you need to read all items but do you need to do this everytime the application is run or can you do it just once "by hand". E.g. does the data change everytime you run the program so that you need to update the dataset everytime you run the program. If this is the case then the only way I can think of is if you do it in a loop, iterating through all the ListViewItems.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Hello!
I have programmed an MS Office add-in that lets the user push a button, enter some information in a custom dialog and then print the e-mail. My problem is that I want to give the user the possibility to select whether he/she prints the e-mail with or without attachments.
Any idea how to do this so that the user doesn't have to change the setting manually in the print dialog beforehand? It should work in Outlook 2000 and Outlook 2003 at least.
TIA, Mario
-- modified at 3:57 Thursday 20th July, 2006
|
|
|
|
|
Hi,
I'm using Microsoft's DAAB, and I am just a bit confused as to what variables I must "dereference".
I have the following peace of code (not all code is shown):
Database db = DBHelper.GetDefaultDatabase;
using (dbCommand = db.GetStoredProcCommand("sp_OrderTypes_GetAllOrderTypes"))
{
using (rdr = db.ExecuteReader(dbCommand))
{
while (rdr.Read())
{
....
}
}
}
The rdr and dbCommand variables are taken care of by the using block, but what about the db variable? Is it ok as it is? Don't I have to close or "dereference" it anywhere?
Please can someone help with my confusion.
Thanks
ma se
|
|
|
|
|
If the Database type provides a Close or Dispose method or something similar you should definitely call it.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
hi,
Just wanted to ask how to make the windows service interactive in .net 2.0, can any body help... I have changed the registry value to type to 272(dec) in LocalMachine\SYSTEM\CurrentControlSet\Services\SERVICENAME registry key... but still its not working... can any body help please...
Thanks,
Regards,
Waqas
|
|
|
|
|
Microsoft now advise against interactive services. They can be susceptible to 'shatter' attacks, where a non-privileged process can cause the service to execute some privileged action by sending it window messages. By definition an interactive service has to run as the SYSTEM account which is very highly privileged - you should endeavour to configure your service to run with the lowest privileges possible.
In Windows Vista and "Longhorn" Server, an interactive user session will be session 1, while the interactive services will run in session 0 as they do now. As a result, the user will not see any UI that the interactive service displays - 'interactive' services will only be able to interact with each other. I have an interactive service written in VB6 which suffers from exactly this problem.
If you need UI, you'll need to come up with a way for a separate UI process to communicate with your service.
Stability. What an interesting concept. -- Chris Maunder
-- modified at 6:05 Thursday 20th July, 2006
|
|
|
|
|
how can i use this.controls in c#. i need to control the label
for example..
for(int i=1; i<4; i++)
{
label(i).text = "";
}
how can i control the labels in this situation... i don't know how to use this.controls in this situation or are there other ways.
|
|
|
|
|
foreach(Control c in Controls)
{
Label l = c as Label;
if (l != null) l.Text = "";
}
Remember, C# is case sensitive.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Would you also use this?
foreach(Control c in this.Controls)
{
if(c is Label)
c as Label.Text = "";
}
All the best,
Martin
|
|
|
|
|
Using 'is' followed by 'as' causes two runtime type lookups to occur, one to do the boolean test, the other to actually perform the cast. Using 'as' alone followed by a test for null performs better.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Martin# wrote: c as Label.Text = "";
Apart from being a mess because it requires two lookups ( as someone else said ), I don't think this will work as you've typed it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Sure,
foreach(Control c in this.Controls)
{
if(c is System.Windows.Forms.Label)
{
System.Windows.Forms.Label l = c as System.Windows.Forms.Label;
l.Text ="";
}
}
-- modified at 7:15 Thursday 20th July, 2006
|
|
|
|
|
|
Of course,
I really understud what everybody else explaint me before.
but thanks for youre interest,
All the best,
Martin
|
|
|
|
|
Thanks for your statements,
All the best,
Martin
|
|
|
|
|
Is there no way, that
c as Label
causes an exception?
Thanks for youre time.
Martin
-- modified at 7:42 Thursday 20th July, 2006
|
|
|
|
|
No, c as Label will return null if c is not a Label.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|