|
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
|
|
|
|
|
Dude I am still not able to do it
|
|
|
|
|
I am still trying to do it but not working still can anybody please look into ......
//this.dgview1.ItemDrag += new System.Windows.Forms.ItemDragEventHandle(this.dgview1_ItemDrag);
this.dgview1.DragEnter += new System.Windows.Forms.DragEventHandler(this.dgview1_DragEnter);
//this.dgview1.DragDrop += new System.Windows.Forms.DragEventHandler(this.dgview1_DragDrop);
this.dgview1.MouseDown += new System.Windows.Forms.MouseEventHandler(dgview1_MouseDown);
private void dgview1_ItemDrag(object sender,System.Windows.Forms.ItemDragEventArgs e)
{
DoDragDrop(e.Item, DragDropEffects.Move);
}
protected void dgview1_DragEnter(object sender,System.Windows.Forms.DragEventArgs e)
{
e.Effect = DragDropEffects.Move;
MessageBox.Show(e.Data.GetData("Text").ToString());
}
void dgview1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
DataGridView.HitTestInfo info = dgview1.HitTest(e.X, e.Y);
if (info.RowIndex >= 0)
{
DataRowView view = (DataRowView)
dgview1.Rows[info.RowIndex].DataBoundItem;
if (view != null)
dgview1.DoDragDrop(view, DragDropEffects.Copy);
}
}
}
|
|
|
|
|
sam12874 wrote: I am still trying to do it but not working still
"but not working" is NOT specific.
led mike wrote: Help with what, what specifically is your problem?
Now you're done. Good luck.
led mike
|
|
|
|
|
Hi,
Is it possible to set the DataGridViewComboBoxColumn drop down to auto-size horizontally to the contents of item with maximum length in Items Collection?
I want to be able read any item in the collection.
thanks in advance..
|
|
|
|
|
Yes it is possible
Set your control's width in percentage ("width=100%").
Set your tamplate column's width to 100% again.
Arun Singh
Noida.
|
|
|
|
|
Thank you for your answer.
It's windows app.
Can you be a bit more precisely?
dataGridViewComboBoxColumn1.DropDownWidth = 100%;//or "100%"; - it doesn't work.
|
|
|
|
|
Hello,
I have created a folder in my vs2005 application with a name Model.
When i renamed this folder to Manager , my application still see that folder as Model
What to do?
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
close your application and rename it directly and then reopen ur visual studio
|
|
|
|
|
Hi all,
does anyone know how to connect to Sybase IQ with using ODBC driver?
Is there something DataProvider library can be used?
thanks,
jim
|
|
|
|
|
I would like to convert from double to int, 96.7 to int32, without rounding.
For instance, I want the result to be 96 not 97. When I put Convert.ToInt32(96.7), the result is always be 97. I just want 96.Why?
|
|
|
|
|
Math.Floor is what you want. why ? because .7 rounds up by default.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Did you read the manual?
"Convert.ToInt32 Method (Double)
Return Value
value rounded to the nearest 32-bit signed integer. If value is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. "
|
|
|
|
|
What was wrong with my answer[^] a few hours ago?
modified on Monday, June 16, 2008 10:37 AM
modified 12-Sep-18 21:01pm.
|
|
|
|
|
That was 20 hours ago, they may have changed how the framework works since then...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I am so sorry, I didn't catch you answer 20 hours ago.
|
|
|
|
|
Hi,
we developed windows application using c#. its working fine in local and remote machine(server). I mapped my local folder from remote machine. its ok. now when I am trying to open application it is not opening. after mapping only its not opening. when trying individually its opening.
where am going wrong? can any one help me?
|
|
|
|
|
Give us an example, because frankly I don't understand your question.
|
|
|
|
|
in my local and remote machine folder contains all the files and exe file. when i click exe file application is opeing in both local and remote.. I had given sharing to my local folder and now in romote machine right click on mycomputer and select map network drive there I had given my local machine name and folder in folder text box. it created networkmap drive. now when click exe file from mappednetwork drive it is not opening.
|
|
|
|
|
What error message is displayed when started from network drive? What .Net framework are you using?
I guess you're problem is related to code access security.
|
|
|
|
|
it is not displaying any error. simply the window is went off. am using framework 2.0.
|
|
|
|
|
Hello.
I this txt file:
2
0 0 20 177 185 4
0 0 20 75 65 4
0 0 20 85 65 4
0 0 20 95 65 4
end
Where I divide the data into valid and unvalid lines
All the data is saved into an array
The valid data is:
0 0 20 177 185 4
0 0 20 75 65 4
0 0 20 85 65 4
0 0 20 95 65 4
And the unvalid data is:
2
end
I go through the array using two buttons:
Forward and previous
I have a int variable called currentLineNumber which contains the selected line from the array
When pressing forward the currentLineNumber is increased and decreased when pressing previous
My problem is that I need to enable and disable these two buttons on a certain point
For example if I am on the line
0 0 20 95 65 4
I want to disable the forward button since there is no valid data after that line
My question is:
How do I enable/disable these buttons when I reach the end of valid data?
Hope you understand otherwise just ask
|
|
|
|
|
Casper Hansen wrote: How do I enable/disable these buttons when I reach the end of valid data?
I guess you decide that, if you have no data to do it off, you have to define your own rules, surely ?
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|