|
You want to use the Enum.Parse static method
public static object Parse(<br />
Type enumType,<br />
string value,<br />
bool ignoreCase<br />
);
Applying this method to your example goes like this:
key = (Keys)Enum.Parse(typeof(Keys), input, true);
Don't forget to sanitize the input value.
|
|
|
|
|
It doesn't always work (Unicode & foreign languages are the trickiest) but you can simply cast them:
key = (Keys)input;
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
I tried this and got error CS0030: Cannot convert type 'string' to 'System.Windows.Forms.Keys'
|
|
|
|
|
Input has to be a char not a string . If you know your input will be a string but only one character long then you can use:
Keys output = (Keys)input[0];
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
|
I was just doing some google searches looking for ways to improve the GUI of my C# app. I stumbled upon Codejock Software and seen they have some really nice C# components. Right now their CommandBars component is still in beta, but I like what I have seen so far. You can find the beta here: http://codejock.com/downloads/[^]
So what do you guys think of this? Should I use this? Any cons to using a third party component?
Thanks
|
|
|
|
|
gerbiling wrote: Any cons to using a third party component?
No. There are no problems ever. Good luck
led mike
|
|
|
|
|
led mike wrote:
No. There are no problems ever. Good luck
Nice level there. You got just the right mix of sincerity and bitter sarcasm in.
|
|
|
|
|
I figured I might as well fish for some more one votes, they seem pretty easy to catch these days.
led mike
|
|
|
|
|
led mike wrote: they seem pretty easy to catch these days.
MVP's - Most Voted-against People.
|
|
|
|
|
gerbiling wrote: Any cons to using a third party component?
We've been conned by a few vendors in the past.
Try to get components where you have access to the sourcecode. If something goes wrong, it's always handy to have the source so that you can fix it if you get no joy from the component author. If your application periodically crashes because of a 3rd party component, it's your application that gets the bad reputation - not the component.
|
|
|
|
|
CodeJock makes excellent components for C++; I would expect their C# components to be as good.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I prefer Telerik, since their trials are always working. The only downside to a trial is that you get a trial message at startup sometimes.
Although there are some bugs, you can report them on their website and they usually have them fixed within the next patch.
|
|
|
|
|
I have a treeview which populated by an XML file containing backuped files,
Now each file in the treeview has the filesize in its name.
But folders dont have filesize now im trying to add it its fairly easy loop trough the treeview and add the foldersize BUT ONLY 1 lvl deep.
I just dont know how to do a multi childnode loop that would properly count backwards if you catch my drift.
|
|
|
|
|
Scalee wrote: I just dont know how to do a multi childnode loop that would properly count backwards if you catch my drift.
Perhaps you could use recursion
led mike
|
|
|
|
|
I want to get the IP addresses of all the computers which are connected to the LAN, and send a file to one of them with its IP address, how should I do that with socket programming?
|
|
|
|
|
semiramisContraA wrote: how should I do that with socket programming?
Use System.Net.Sockets.Socket
Also read the first post in the forum "How to get an answer to your question" pay attention to item #2
led mike
|
|
|
|
|
I'm having a problem with aspx in c#. I have five different classes
performing five different tasks that are being called using
five chackboxes in a .aspx page, when in each class, I want to inform the user
which class performs its operation at the moment, using a label in the page, like this:
info.Text="class 1 is performing its operation";
I pass the label as an argument to the constructor of each class so that it will be able to change it, the problem is that
the changes do not take place till very late during runtime, I mean the textbox doesn't change after the line of code I mentioned, t changes after
the class has finished it's operation.
What should I do? Are there any functions like flush() provided in c# which make the changes being made at the exact time?
|
|
|
|
|
You have to understand how web pages work. The user clicks your button, it sends a request to your web server, the .net worker process processes the request, performs all actions, then builds the html and shoots it back to the user's web browser. There is no point in here with ASP.net can tell the client to show a loading message. You must use a client side language to do this (like javascript).
I hope I was clear.
|
|
|
|
|
I'm using javascript, but it doesn't show itself to the user at the time I want, but later when the running is finished!
|
|
|
|
|
1. You should have posted this in the ASP.NET forum.
2. Use AJAX if you need to do this.
|
|
|
|
|
Hi,
I am able to drag and drop into trees but Now I have to drag n drop from tree to data grid.Can Anybody please help me in that
Thanks
p.s ---> C# code
|
|
|
|
|
sam12874 wrote: I am able to drag and drop into trees
So you have some knowledge of how drag/drop works, good.
sam12874 wrote: Now I have to drag n drop from tree to data grid.Can Anybody please help me in that
Help with what, what specifically is your problem?
led mike
|
|
|
|
|
This is the code snippet , This works well for tree drag n drop but now I have to do the same with tree and datagrid instead of tree and tree,If you are not understanding still please let me no Thanks
TreeDataID = treeViewdataitemID();
if (TreeDataID.Tables.Count > 0)
{
foreach (DataRow row in TreeDataID.Tables[0].Rows)
{
TreeNode newNode = new TreeNode();
newNode.Text = "[" + row["DataItemID"].ToString() + "]" + row["LocalDisplayname"].ToString();
this.treeDataItemIDView.Nodes.Add(newNode);
}
}
this.treetab3licgrpView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeView_ItemDrag);
this.treeDataItemIDView.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeView_ItemDrag);
this.treetab3licgrpView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView_DragEnter);
this.treeDataItemIDView.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView_DragEnter);
this.treetab3licgrpView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop);
this.treeDataItemIDView.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop);
private void treeView_ItemDrag(object sender,System.Windows.Forms.ItemDragEventArgs e)
{
DoDragDrop(e.Item, DragDropEffects.Move);
}
private void treeView_DragEnter(object sender,System.Windows.Forms.DragEventArgs e)
{
e.Effect = DragDropEffects.Move;
}
private void treeView_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
TreeNode NewNode;
if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
{
Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt);
NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
if (DestinationNode.TreeView != NewNode.TreeView)
{
DestinationNode.Nodes.Add((TreeNode)NewNode.Clone());
DestinationNode.Expand();
//Remove Original Node
//NewNode.Remove();
}
}
}<pre></pre>
|
|
|
|
|
Ok, that looks somewhat complete. So now do similar for the Grid. Good luck.
led mike
|
|
|
|