|
Hello everyone!
I'm wondering if you could give me some tips on managing keyboard shortcuts in a winform application. I want to be able to create a dialog where the user can change the keyboard shortcuts to different commands. Right now I just add them to the ShortcutKeys property of a menu item and thats not very manageable.
Thanks in advance!
-Martin
|
|
|
|
|
Hi,
Dear you have to store the text property of that object say in (setting.config) some ware and then each time you load your application you can read that setting.config file to put the that text for that object in the winform.
Regards
|
|
|
|
|
Not exactly sure how you mean. I think I understand that you want me to connect the ShortcutKeys property to a user setting in Settings.settings? If I create a new MenuItem class which has a command class connected to it this could work but what about the keyboard shortcuts that I want connected to a command which is not in the menu?
What I want it something like what Visual Studio has. All the different commands show up in a list and you can connect keyboard shortcuts to them. I also want plug-ins to be able to add their commands to the list.
Let's say I have all these command classes; NewFileCommand, OpenFileCommand, ExitApplicationCommand, etc. I also have a plug-in which has too commands; ShowGraphPlugin, ShowListPlugin. Now I need to get these commands into the keyboard shortcut configuration dialog and be able to connect a command to a keyboard shortcut. Not sure how to do that...
-Martin
|
|
|
|
|
I was thinking, if I create a new menu item class that is connected to a command class/object. Wouldn't it be better if I concentrate on connecting a keyboard shortcut to a command instead? Then when the menu item gets the command it can somehow retrieve the connected keyboard shortcut (if any) and show it as it's own keyboard shortcut?
Then I guess all the keyboard shortcuts in the application would have to go through some manager class and I would have to have some list connecting commands to shortcut keys...
Is this good or bad?
-Martin
|
|
|
|
|
hey everyone, i'm writing a 3d game using truevision 6.3 as the game engine. it's a racing game but i still can't figure out how to turn with the directional key rather than a mouse. the whole concept of the game is to use first person view while racing instead of the camera following the mesh/actor.
please if anyone can help me out lemme know. i've got just 2 months to present this as my final year project.
thanks
|
|
|
|
|
anarchi23,
Might be a better idea to ask on the "truevision" forum.
Regards,
Gareth.
|
|
|
|
|
hi all
How can I send an email with C#?
|
|
|
|
|
using System.Net.Mail
Crate a object of MailMessage Class
MailMessage Mail = new MailMessage();
Now set , Mail.To, Mail.From, Mail.Subject, Mail.Body Property.
Create object of Smtp Class
SmtpClient ss = new SmtpClient("Server");
Now Send
ss.Send(Mail)
This is basic idea. You will get lots of sample by googling !!!!!
Good luck
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
modified on Saturday, February 23, 2008 6:08 AM
|
|
|
|
|
Hey guys, I'm using stored procedure to insert data to my database, I works perfectly. after clickin the button it inserts the information. but when I again want to enter new information and press the button I get this error >> Procedure or function ExpenseEntery has too many arguments specified.
<br />
InsertCmd.Connection = MyCon;<br />
InsertCmd.CommandType = CommandType.StoredProcedure;<br />
InsertCmd.CommandText = "ExpenseEntery";<br />
<br />
InsertCmd.Parameters.Add("@ID", SqlDbType.Int).Value = GetID;<br />
InsertCmd.Parameters.Add("@ClientID", SqlDbType.Int).Value = UserID;<br />
InsertCmd.Parameters.Add("@ExpenseID", SqlDbType.TinyInt).Value = SelectedExpense;<br />
InsertCmd.Parameters.Add("@DateOfPurchase", SqlDbType.VarChar, 8).Value = SelectedDate;<br />
InsertCmd.Parameters.Add("@Cost", SqlDbType.Money).Value = Convert.ToInt64(Cost_tb.Text);<br />
InsertCmd.Parameters.Add("@Number", SqlDbType.Int).Value = Convert.ToInt32(Number_tb.Text);<br />
InsertCmd.Parameters.Add("@TotalCost", SqlDbType.Money).Value = Total;<br />
InsertCmd.Parameters.Add("@Comment", SqlDbType.NVarChar, 300).Value = Comment_tb.Text;<br />
InsertCmd.Parameters.Add("@DeleteFlag", SqlDbType.Bit).Value = "false";<br />
<br />
MyCon.Open();<br />
InsertCmd.ExecuteNonQuery();<br />
MyCon.Close();
|
|
|
|
|
seems that you use InsertCmd again without clearing its parameters.
Clear the command parameters or create a new instance.
|
|
|
|
|
thanx buddy ! it solved the problem !!!
Mr.K
|
|
|
|
|
Or only add them the first time.
|
|
|
|
|
Yes.thats right
Because every time that you execute your methode, InsertCmd object define some parameter with same name.
Define InsertCmd in local manner.
|
|
|
|
|
Hello Everybody,
I need help for generating Random Numbers......
and need to add current system date with that generated number....
Please help
Thanks
modified on Saturday, February 23, 2008 4:45 AM
|
|
|
|
|
base64 is an encoding not a number system, what do you need to do exactly? generate a number then encode it ?
|
|
|
|
|
Hi,
its a mistake in writting question.
i want to generate random numbers that unique with a combination of current date...
means if my random number is 757454584 then its will never generate again so i want some extra digits at the end for unique number that i think the current date 757454584 + 230208
so it will give me the perfect random number...
But i am unable to achive this..
can u help me...
|
|
|
|
|
Dikshant,
Random random = new Random();
string randomString = (DateTime.Now.ToString() + "_" + random.Next().ToString());
random.Dispose();
Above gives you "23/02/2008 11:08:23_3243243242"
|
|
|
|
|
Hi,
what exactly are you trying to accomplish? Do you need a specific distribution, or a constant length, for example?
If you just need some keys that do not collide, i.e. keys which are (almost) unique, you might want to take a look at UUIDs or GUIDs. They are time-based, but in a more subtle manner. Their length is constant. However, they are usually written in hexadecimal strings, e.g.: {2AED1BB2-7314-43e9-9DE7-8AAB3BBC20C1}.
Or do you just need something like
Random a = new Random();<br />
string x = String.Format("{0}{1}", a.Next(), DateTime.UtcNow.Ticks);
?
yielding, for example, this:
"2143552667633393651580403445"
Note that this has a variable length, because
a.Next() returns some number which can be shorter or longer.
Also note that a, if initialized without a seed will use the system time as seed, thus creating completely different numbers on each run (these alone, however, have a rather large chance of colliding).
In general, there are no keys which can *never* collide (unless they have infinite legth...), but you can make it extremely unlikely to happen.
Hope that helps,
Chris
"Obstacles are those frightening things you see when you take your Eyes off your aim"
- Henry Ford
Articles
Blog
|
|
|
|
|
Please avoid removing a question that someone already has replied to. It's a bit confusing to read replies to a question that has changed completely. You can strike out text when you edit the question.
You can use the Ticks property to get a DateTime value as a number.
You should use DateTime.UtcNow rather than DateTime.Now to get the time. The local time is affected by daylight savings time, so it's not unique, i.e. once a year it overlaps for an hour.
string id = myRandomNumber + "_" + DateTime.UtcNow.Ticks.ToString();
But if you want a unique random number, why are you not using a GUID?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thank you all for solution....
And Sorry that i have to edit it.....
Again thanks
Dikshant
|
|
|
|
|
You can use GUIDs. or use Cryptography classes (as RNGCryptoServiceProvider ) to generate the random value.
The advantage of using RNGCryptoServiceProvider is that you can select the length of the generated value.
Here is an example (I choosed the length = 50):
using System.Security.Cryptography;
.
.
.
byte[] data = new byte[50];
RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
for (int i = 0; i < 50; i++)
{
rand.GetBytes(data);
string s = Convert.ToBase64String(data);
Console.WriteLine(s);
}
|
|
|
|
|
Hi, i have written one windows sevice and i have been build that service.
An exe file is generated for that service. using installutil.exe that file has been installed. but the service is not showing under Administrtaivetools->services.
Is the service not created? or any other reason.
I am getting succesful message in command prompt after using istallutil.
please help me regarding this.
G. Satish
|
|
|
|
|
Dear try (RegSvcs.exe) utility provided in .net framework to register services.
Regards
|
|
|
|
|
Hi friends..
I am working in windows application(MDI).I am using graphicspath method to draw the figure..some time i got output as bezier figure instead of normal figure...for example to draw straight line(both vertical and horizontal) i got output as normal figure... other than straight line i got bezier figure as output... how to avoid this.....
|
|
|
|
|
I"m not sure I follow. Sometimes your path draws a bezier ? I guess the question is, where does the path come from, and why can't you just not create it as a bezier path ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|