|
Wow, that was fast
Thanks, I understand now
|
|
|
|
|
If I accidentally click on a GUI element or a form in the VS Editor, it produces event code for that element, even if I don't want to handle that event. Then if I deleted that code I get an error. It's annoying and it clutters up my code.
Is there a way to get rid of this code, or somewhere I shold move it?
Thanks
James
|
|
|
|
|
In the IDE go to the properties window, change to events view, right click the offending event and RESET.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for your help Mycroft, and excuse my human stupidity.
James
modified on Thursday, January 22, 2009 5:55 AM
|
|
|
|
|
Not a problem, I only recently found that when it turns out C#/VS2008 does not automatically remove it from the designer file
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yeah, that's a pain, but it was easily discovered in the error list when a compile is attempted, right?
I considered the original message to be a stupid question given the relative simplicity of the answer (all he had to do was double-click the error and it would have taken him to the offending code in the designer).
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello,
I want to add a new menu item in winXP Explorer context menu (right click menu).
For example, I right click in winXP Explorer, and the "newCommand" option is shown.
Can this be done via C#?
Thanks!
|
|
|
|
|
Plenty of examples around clickety[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
can any one help me how to implement global.aspx in c#.net.If any one knows give me the detail steps !!
|
|
|
|
|
Try The Google Machine[^]
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Hi EveryBody,
How to Drag and Drop Treeview Item into listview? Please help me out..
I have one parent node and two child nodes. when I drag a Parent Node, included child nodes are also to be dragged.
And all of them to be placed in listview row (3 columns).
Please help me out with a sample example. Itz very urgent for me
|
|
|
|
|
|
Udayaraju wrote: Itz very urgent for me
... but not urgent for us. I saw your post hours ago but ignored it because of this. Bumping your post will not get you any further.
I won't give you the code but I'll give you the theory so you can code it yourself. If you get stuck with a specific part of your code, post it and we'll have a look.
What you want is a very simple 3 step process.
In the treeview's mousedown event , get the node at the mouse point. Set the selectednode to be that node If it's not null and is a 'Parent' node, call the treeview's DoDragDrop method.
In the listview's dragover event, set the effect property of the event arguments to copy.
In the litview's DragDrop event, convert the data to a treenode (would be a good idea to null check here too) then convert it and it's nodes (children) to a listviewitem with listviewsubitems and add to your listview.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi,
Thanq for ur Suggestion But i tried inthes way..can you corect the problem here.
See the below code. Here I have a Problem. Treeview has already one root node and twochild nodes with it.
They have to be dragged and dropped in listview.
The main Problem is wen I drag an item..the Itemdrag event is not fired.?? Please try to resolve it.
private void tvwSalesProducts_ItemDrag(object sender, ItemDragEventArgs e)
{
tvwSalesProducts.DoDragDrop(e.Item, DragDropEffects.Copy | DragDropEffects.Move);
}
private void lstMultiProItems_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy | DragDropEffects.Move;
}
private void lstMultiProItems_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
{
string[] Items = new string[5];
TreeNode SourceNode;
SourceNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
Items[0] = Convert.ToString(SourceNode.Tag);
Items[1] = SourceNode.Text.ToString();
Items[2] = SourceNode.FirstNode.Text.ToString();
Items[3] = SourceNode.LastNode.Text.ToString();
lstMultiProItems.Items.Clear();
lstMultiProItems.Columns.Add("ID", 100, HorizontalAlignment.Left);
lstMultiProItems.Columns.Add("Product Name", 100, HorizontalAlignment.Left);
lstMultiProItems.Columns.Add("Selling Price", 100, HorizontalAlignment.Left);
lstMultiProItems.Columns.Add("Conversion", 100, HorizontalAlignment.Left);
ListViewItem Item1 = new ListViewItem(Items);
lstMultiProItems.Items.Add(Item1);
lstMultiProItems.AllowColumnReorder = false;
lstMultiProItems.FullRowSelect = true;
}
}
|
|
|
|
|
Check out the working code below and compare - you should be able to figure it out from this.
void treeView1_ItemDrag(object sender, ItemDragEventArgs e)
{
TreeNode nodeData = (TreeNode)e.Item;
treeView1.SelectedNode = nodeData;
if ((string)nodeData.Tag == "Parent" && nodeData.Nodes.Count == 2)
treeView1.DoDragDrop(nodeData, DragDropEffects.Copy);
}
void listView1_DragOver(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.None;
TreeNode nodeData = (TreeNode)e.Data.GetData(typeof(TreeNode));
if (nodeData != null && (string)nodeData.Tag == "Parent" && nodeData.Nodes.Count == 2)
e.Effect = DragDropEffects.Copy;
}
void listView1_DragDrop(object sender, DragEventArgs e)
{
TreeNode nodeData = (TreeNode)e.Data.GetData(typeof(TreeNode));
if (nodeData != null && (string)nodeData.Tag == "Parent" && nodeData.Nodes.Count == 2)
{
ListViewItem newItem = new ListViewItem(nodeData.Text);
foreach (TreeNode childNode in nodeData.Nodes)
{
ListViewItem.ListViewSubItem newSub = new ListViewItem.ListViewSubItem();
newSub.Text = childNode.Text;
newItem.SubItems.Add(newSub);
}
listView1.Items.Add(newItem);
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Thanq very mUch Dave..... these may help me a Lot.
I wil go through It and cum with u New errors..
Jus Kidding
|
|
|
|
|
Guys Please Help me out,
I have added the event handlers from front end design. but still the event is not fired.
Can u please tel me wther the code is correct or not
|
|
|
|
|
Hello,
I have a below issue with the windows service.
I have a method as below
private void OnElapsedTime(object source, ElapsedEventArgs e)
{
log.Info("OnElapsedTime");
BillPay.ProcessOrder();
}
I have a timer set for 1 mins in OnStart method
protected override void OnStart(string[] args)
{
//ad 1: handle Elapsed event
timer.Elapsed += new ElapsedEventHandler(OnElapsedTime);
//ad 2: set interval to 1 minute (= 60,000 milliseconds)
timer.Interval = 60000 ;
//ad 3: enabling the timer
timer.Enabled = true;
}
The problem:
If my ProcessOrder() method which process all orders do not get completed in 1 mins I see unexpected results in the database with duplicate entry. I suspect the method ProcessOrder() get called again onTimeElapsed, I have commit and rollback statements too. But does not help.
Please suggest as how can I resolve this issue.
Regards,
Pavas
|
|
|
|
|
Stop the timer while you call the method, so that it does not start the event handler in another thread.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
So when it will again start?
Regards,
Pavas
|
|
|
|
|
I believe, timer will start right after the method call is over..let me try this
Regards,
Pavas
|
|
|
|
|
It will start when you turn the timer on again.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Put your work into a thread, and fire off the thread each time the timer ticks. You can even prevent multiple threads from kicking off with appropriate code in the tick handler.
Personally, I wouldn't use a Timer object because it's the lowest priority message in Windows, and in a busy system, there's no guarantee the message will even be handled. Instead, I use a BackgroundWorker object for timers because they can be easily aborted. Sure, it's more code (go forbid a programmer should have to actually write some code), but it's much more reliable and controllable.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: Personally, I wouldn't use a Timer object because it's the lowest priority message in Windows, and in a busy system, there's no guarantee the message will even be handled. Instead, I use a BackgroundWorker
That is true for a Windows Forms timer running on the UI thread. But the OP is writing a service, so he's probably using System.Threading.Timer or System.Timers.Timer . AFAIK, both of them use the ThreadPool, and so does BackgroundWorker
|
|
|
|
|
i can do parent dynamic gridview --> child dynamic gridview but ive a problem at the interface of triple dynamic gridviews how do i do for that ??
|
|
|
|