Click here to Skip to main content
15,907,001 members
Home / Discussions / C#
   

C#

 
AnswerRe: spliting string...need help Pin
Mark Churchill16-Aug-07 16:49
Mark Churchill16-Aug-07 16:49 
GeneralRe: spliting string...need help Pin
TheCardinal16-Aug-07 16:58
TheCardinal16-Aug-07 16:58 
QuestionIs this forum useful any more? Pin
KrunalC16-Aug-07 16:06
KrunalC16-Aug-07 16:06 
AnswerRe: Is this forum useful any more? Pin
Christian Graus16-Aug-07 16:10
protectorChristian Graus16-Aug-07 16:10 
GeneralRe: Is this forum useful any more? Pin
KrunalC16-Aug-07 16:17
KrunalC16-Aug-07 16:17 
GeneralRe: Is this forum useful any more? Pin
leckey17-Aug-07 3:12
leckey17-Aug-07 3:12 
GeneralRe: Is this forum useful any more? Pin
KrunalC17-Aug-07 3:31
KrunalC17-Aug-07 3:31 
GeneralRe: Is this forum useful any more? Pin
leckey17-Aug-07 5:46
leckey17-Aug-07 5:46 
GeneralRe: Is this forum useful any more? Pin
Paul Conrad16-Aug-07 16:24
professionalPaul Conrad16-Aug-07 16:24 
GeneralRe: Is this forum useful any more? [modified] Pin
Scott Dorman16-Aug-07 16:29
professionalScott Dorman16-Aug-07 16:29 
GeneralRe: Is this forum useful any more? Pin
Guffa16-Aug-07 16:25
Guffa16-Aug-07 16:25 
GeneralRe: Is this forum useful any more? Pin
KrunalC16-Aug-07 16:28
KrunalC16-Aug-07 16:28 
GeneralRe: Is this forum useful any more? Pin
Scott Dorman16-Aug-07 16:32
professionalScott Dorman16-Aug-07 16:32 
GeneralRe: Is this forum useful any more? Pin
KrunalC16-Aug-07 16:39
KrunalC16-Aug-07 16:39 
AnswerRe: Is this forum useful any more? Pin
Michael Sync16-Aug-07 16:39
Michael Sync16-Aug-07 16:39 
GeneralRe: Is this forum useful any more? Pin
KrunalC16-Aug-07 16:44
KrunalC16-Aug-07 16:44 
GeneralRe: Is this forum useful any more? Pin
Michael Sync16-Aug-07 16:59
Michael Sync16-Aug-07 16:59 
GeneralRe: Is this forum useful any more? Pin
KrunalC16-Aug-07 17:08
KrunalC16-Aug-07 17:08 
GeneralRe: Is this forum useful any more? Pin
jith - iii16-Aug-07 18:06
jith - iii16-Aug-07 18:06 
GeneralRe: Is this forum useful any more? Pin
Judah Gabriel Himango16-Aug-07 19:05
sponsorJudah Gabriel Himango16-Aug-07 19:05 
GeneralRe: Is this forum useful any more? Pin
jith - iii16-Aug-07 19:21
jith - iii16-Aug-07 19:21 
QuestionTreeView does not show selected node! Pin
Mark F.16-Aug-07 13:17
Mark F.16-Aug-07 13:17 
First of all, I have HideSelection set to false. I implemented drag and drop in a TreeView so that the indexed cards in the tree can be moved manually (cards store book info like Library card files). An XML file is updated with the newly arranged tree. The TreeView is refreshed in the Drag_Drop event, but the SelectedNode does not show!

Is there a workaround for this?

Here's the code...,
<small>private void cardsTreeView_DragDrop( object sender, DragEventArgs e )
{
    nodePosition.X = e.X;
    nodePosition.Y = e.Y;
    nodePosition = cardsTreeView.PointToClient(nodePosition);

    TreeNode dropNode = cardsTreeView.GetNodeAt(nodePosition);

    if (dropNode != null && dropNode.Parent == this.nodeToDelete.Parent)
    {
        TreeNode dragNode = this.nodeToDelete;
        
        if (dropNode == dragNode)
            return;

        dropNode.Parent.Nodes.Remove(this.nodeToDelete);
        dropNode.Parent.Nodes.Insert(dropNode.Index + 1, dragNode);

        Cards.MoveCardTo(GetIndexString(dropNode), GetIndexString(nodeToDelete));
        Cards.ReOrderCards();

        if (cardsTreeView.Nodes.Count > 0)
            cardsTreeView.Nodes.Clear();

        cardsTreeView.BeginUpdate();

        // load all cards from XML document
        Cards.GetAllCards(ref cardsTreeView);

        cardsTreeView.EndUpdate();
        cardsTreeView.ExpandAll();
       
        cardsTreeView.EndUpdate();
        
        // Fails to show the selected node 
        cardsTreeView.SelectedNode = cardsTreeView.Nodes[dropNode.Index];
        cardsTreeView.SelectedNode.EnsureVisible();
    }
}

private void cardsTreeView_DragEnter( object sender, DragEventArgs e )
{
    if(e.Data.GetDataPresent(DataFormats.Text))
        e.Effect = DragDropEffects.Move;
    else
        e.Effect = DragDropEffects.None;
}

private void cardsTreeView_ItemDrag( object sender, ItemDragEventArgs e )
{
    nodeToDelete = (TreeNode) e.Item;
    string strItem = e.Item.ToString();
    DoDragDrop(strItem, DragDropEffects.Copy | DragDropEffects.Move);
}
</small>


Thanks,
Mark
AnswerRe: TreeView does not show selected node! Pin
Mark Churchill16-Aug-07 21:16
Mark Churchill16-Aug-07 21:16 
GeneralRe: TreeView does not show selected node! Pin
Mark F.19-Aug-07 7:28
Mark F.19-Aug-07 7:28 
GeneralRe: TreeView does not show selected node! Pin
Mark Churchill19-Aug-07 15:03
Mark Churchill19-Aug-07 15:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.