Click here to Skip to main content
15,921,577 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: need help from all of you... Pin
n_c_s6-Jan-06 3:38
n_c_s6-Jan-06 3:38 
GeneralRe: need help from all of you... Pin
Christian Graus8-Jan-06 9:42
protectorChristian Graus8-Jan-06 9:42 
Questionwhats the code for this in .net? Pin
Mridang Agarwalla4-Jan-06 0:37
Mridang Agarwalla4-Jan-06 0:37 
AnswerRe: whats the code for this in .net? Pin
J4amieC4-Jan-06 2:35
J4amieC4-Jan-06 2:35 
Questiontreeview(binarytree) Pin
mamatharaghu4-Jan-06 0:36
mamatharaghu4-Jan-06 0:36 
AnswerRe: treeview(binarytree) Pin
Paritos4-Jan-06 1:02
Paritos4-Jan-06 1:02 
GeneralRe: treeview(binarytree) Pin
mamatharaghu4-Jan-06 1:41
mamatharaghu4-Jan-06 1:41 
GeneralRe: treeview(binarytree) Pin
J4amieC4-Jan-06 2:48
J4amieC4-Jan-06 2:48 
First a disclaimer: to understand recursion you must first understand recursion Laugh | :laugh:

You want to add X number of nodes, each with 2 children and you want this to go for Y depth?

We will:
Call X - topLevelNodeCount
Call Y - treeDepth

Simply drop a tree view on the form named "treeView" and pase this code in your form

<code><pre>int topLevelNodeCount = 3;
int treeDepth = 5;


protected override void OnLoad(EventArgs e)
{
for(int i = 0;i<topLevelNodeCount;i++)
{
TreeNode newNode = new TreeNode("Top" + i);
this.treeView.Nodes.Add(newNode);
this.AddBinaryNode(newNode,1);
}

base.OnLoad (e);
}

private void AddBinaryNode(TreeNode parent, int depth)
{
// add 1
parent.Nodes.Add(parent.Text + "_Child1");
// add 2
parent.Nodes.Add(parent.Text + "_Child2");

if(depth < treeDepth)
{
int newDepth = depth+1;
AddBinaryNode(parent.Nodes[0],newDepth);
AddBinaryNode(parent.Nodes[1],newDepth);
}
}</pre></code>

-- modified at 8:49 Wednesday 4th January, 2006
GeneralRe: treeview(binarytree) Pin
mamatharaghu4-Jan-06 18:18
mamatharaghu4-Jan-06 18:18 
GeneralRe: treeview(binarytree) Pin
J4amieC4-Jan-06 21:58
J4amieC4-Jan-06 21:58 
GeneralRe: treeview(binarytree) Pin
mamatharaghu5-Jan-06 18:28
mamatharaghu5-Jan-06 18:28 
QuestionFinding the creator/author name of a folder Pin
Kavitha Sathishkumar3-Jan-06 22:52
Kavitha Sathishkumar3-Jan-06 22:52 
AnswerRe: Finding the creator/author name of a folder Pin
Kamalatharsan6-Jan-06 21:27
Kamalatharsan6-Jan-06 21:27 
Questioncoping images from webpage using vb.net Pin
uktrips0073-Jan-06 22:23
uktrips0073-Jan-06 22:23 
QuestionKnow of an organization chart/organogram that takes xml and draws the structure? Pin
QuintesV3-Jan-06 21:27
QuintesV3-Jan-06 21:27 
AnswerRe: Know of an organization chart/organogram that takes xml and draws the structure? Pin
QuintesV3-Jan-06 21:29
QuintesV3-Jan-06 21:29 
QuestionVB ActiveX Control Pin
GayathriNaveen3-Jan-06 19:10
GayathriNaveen3-Jan-06 19:10 
QuestionLinking database over FTP Pin
Roshan Sumbaly3-Jan-06 18:04
Roshan Sumbaly3-Jan-06 18:04 
AnswerRe: Linking database over FTP Pin
Dave Kreskowiak4-Jan-06 5:53
mveDave Kreskowiak4-Jan-06 5:53 
QuestionIntranet Application Pin
Aanchal Naidu3-Jan-06 17:45
Aanchal Naidu3-Jan-06 17:45 
AnswerRe: Intranet Application Pin
Dave Kreskowiak4-Jan-06 5:51
mveDave Kreskowiak4-Jan-06 5:51 
Questiontcplistener (VB.NET) Pin
curseddagger3-Jan-06 17:23
curseddagger3-Jan-06 17:23 
AnswerRe: tcplistener (VB.NET) Pin
Dave Kreskowiak4-Jan-06 5:44
mveDave Kreskowiak4-Jan-06 5:44 
GeneralRe: tcplistener (VB.NET) Pin
curseddagger4-Jan-06 14:20
curseddagger4-Jan-06 14:20 
GeneralRe: tcplistener (VB.NET) Pin
Dave Kreskowiak4-Jan-06 18:01
mveDave Kreskowiak4-Jan-06 18:01 

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.