473,769 Members | 4,010 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeView samples

Anybody can shart some working samples of using that control on Windows
form?

Thanks
Nov 15 '05 #1
5 8125
I think MSDN Library should have some. If you are experiencing particular
problems with TreeView, please post them here, or, even better, in the
microsoft.publi c.dotnet.framew ork.windowsform s newsgroup.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Mark Goldin" <ma********@com cast.net> wrote in message
news:Oj******** ******@TK2MSFTN GP11.phx.gbl...
Anybody can shart some working samples of using that control on Windows
form?

Thanks


Nov 15 '05 #2
No I dont experience any PARTICULAR problem.
I am experiencing PROBLEM to get started in .NET.
Usually samples are very helpful.

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:Ok******** ******@TK2MSFTN GP09.phx.gbl...
I think MSDN Library should have some. If you are experiencing particular
problems with TreeView, please post them here, or, even better, in the
microsoft.publi c.dotnet.framew ork.windowsform s newsgroup.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Mark Goldin" <ma********@com cast.net> wrote in message
news:Oj******** ******@TK2MSFTN GP11.phx.gbl...
Anybody can shart some working samples of using that control on Windows
form?

Thanks

Nov 15 '05 #3
I see your point, Mark. Then MSDN examples are a good point to start, as
well as GotDotNet QuickStart tutorials (found at http://www.gotdotnet.com).

You can also look at the .NET 247 portal (http://www.dotnet247.com if I am
not mistaken).

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Mark Goldin" <ma********@com cast.net> wrote in message
news:eS******** ******@TK2MSFTN GP11.phx.gbl...
No I dont experience any PARTICULAR problem.
I am experiencing PROBLEM to get started in .NET.
Usually samples are very helpful.

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:Ok******** ******@TK2MSFTN GP09.phx.gbl...
I think MSDN Library should have some. If you are experiencing particular problems with TreeView, please post them here, or, even better, in the
microsoft.publi c.dotnet.framew ork.windowsform s newsgroup.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Mark Goldin" <ma********@com cast.net> wrote in message
news:Oj******** ******@TK2MSFTN GP11.phx.gbl...
Anybody can shart some working samples of using that control on Windows form?

Thanks



Nov 15 '05 #4
Thanks for help.
Would it be better idea to use third party component for
TreeView? The component that already has (or almost)
functionality I need?
-----Original Message-----
I see your point, Mark. Then MSDN examples are a good point to start, aswell as GotDotNet QuickStart tutorials (found at http://www.gotdotnet.com).
You can also look at the .NET 247 portal (http://www.dotnet247.com if I amnot mistaken).

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Mark Goldin" <ma********@com cast.net> wrote in message
news:eS******* *******@TK2MSFT NGP11.phx.gbl.. .
No I dont experience any PARTICULAR problem.
I am experiencing PROBLEM to get started in .NET.
Usually samples are very helpful.

"Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam- please.hotpop.c om> wrote
in message
news:Ok******** ******@TK2MSFTN GP09.phx.gbl...
> I think MSDN Library should have some. If you are experiencingparticular
> problems with TreeView, please post them here, or,
even better, in the > microsoft.publi c.dotnet.framew ork.windowsform s newsgroup. >
> --
> Dmitriy Lapshin [C# / .NET MVP]
> X-Unity Test Studio
> http://x-unity.miik.com.ua/teststudio.aspx
> Bring the power of unit testing to VS .NET IDE
>
> "Mark Goldin" <ma********@com cast.net> wrote in message > news:Oj******** ******@TK2MSFTN GP11.phx.gbl...
> > Anybody can shart some working samples of using
that control onWindows > > form?
> >
> > Thanks
> >
> >
>



.

Nov 15 '05 #5
The following Method fills a TreeView with the DataSet (and its Tables)
Strucure.
You mut call the Method with a reference to your exsisting TreeView
Control, DataSet to use and a String Array with Branch/Node Strings to use.
In my Projects these Strings are Language dependent and must be filled
beforhand.

OnFillTreeViewD ataSet(ref TreeViewDataSet , ref dset_MainFrame, ref
sa_TreeViewData Set);

Hope this helps as a starter.

Mark Johnson, Berlin Germany
mj*****@mj10777 .de
private void OnFillTreeViewD ataSet(ref TreeView ref_treeView, ref DataSet
dset_MainFrame, ref String[] sa_treeView)
{
string s_DataSet="",s_ TableName="", s_FieldName="";
//---------------------------------------------------------------
string s_DataConnectio ns="";
string s_AmountFields= "",s_AmountRows ="",s_AmountTab les="";
s_DataConnectio ns = sa_treeView[1]; // "Data Connections";
s_AmountFields = sa_treeView[4]; // "Columns";
s_AmountRows = sa_treeView[5]; // "Rows";
if (dset_MainFrame .Tables.Count == 1)
s_AmountTables = sa_treeView[2]; // "Table";
else
s_AmountTables = sa_treeView[3]; // "Tables";
//---------------
// Display a wait cursor while the TreeNodes are being created.
Cursor.Current = Cursors.WaitCur sor;
// Suppress repainting the TreeView until all the objects have been
created.
ref_treeView.Be ginUpdate();
// Clear the TreeView each time the method is called.
ref_treeView.No des.Clear();
// Net.Framework.C ompact does not support new TreeNode(s_Data Set,2,1);
// - thus we must do it per hand in 5 Steps instead of 1, but it should
work on both Systems
TreeNode tn_Node=null;
for (int i_DataSet=0;i_D ataSet<1;i_Data Set++)
{
tn_Node = new TreeNode(); // Step 1 - only this
is possible the NET Framework.Compa ct
tn_Node.Text = s_DataConnectio ns; // Step 2 - we really
don't need s_DataSet !
tn_Node.ImageIn dex = 0; // Step 3 - Not
Selected - DataConnection. gif
tn_Node.Selecte dImageIndex = 0; // Step 4 - Is
Selected - DataConnection. gif
ref_treeView.No des.Add(tn_Node );
if (dset_MainFrame .Namespace != sa_treeView[0])
{
s_DataSet = dset_MainFrame. Namespace;
tn_Node = new TreeNode();
tn_Node.Text = s_DataSet;
tn_Node.ImageIn dex = 1; // Does this work ? -
DataBase_Closed .gif
tn_Node.Selecte dImageIndex = 2; // Does this work ? -
DataBase_Open.g if
ref_treeView.No des[i_DataSet].Nodes.Add(tn_N ode);
tn_Node = new TreeNode();
tn_Node.Text =
dset_MainFrame. Tables.Count.To String()+" "+s_AmountTable s;
tn_Node.ImageIn dex = 8; // - NOTE12.ICO
tn_Node.Selecte dImageIndex = 8; // - NOTE12.ICO
ref_treeView.No des[i_DataSet].Nodes[i_DataSet].Nodes.Add(tn_N ode);
for(int i_Table=0;i_Tab le<dset_MainFra me.Tables.Count ;i_Table++)
{
DataTable dt_Table = dset_MainFrame. Tables[i_Table];
s_TableName = dt_Table.TableN ame;
tn_Node = new TreeNode();
tn_Node.Text = s_TableName;
tn_Node.ImageIn dex = 6; // Does this work ?
tn_Node.Selecte dImageIndex = 5; // Does this work ?

ref_treeView.No des[i_DataSet].Nodes[i_DataSet].Nodes[i_DataSet].Nodes.Add(tn
_Node);
tn_Node = new TreeNode();
tn_Node.Text = dt_Table.Column s.Count+"
"+s_AmountField s+", "+dt_Table.Rows .Count.ToString ()+" "+s_AmountR ows;
tn_Node.ImageIn dex = 9; // - NOTE12.ICO
tn_Node.Selecte dImageIndex = 9; // - NOTE12.ICO

ref_treeView.No des[i_DataSet].Nodes[i_DataSet].Nodes[i_DataSet].Nodes[i_Tabl
e].Nodes.Add(tn_N ode);
for(int i_Fields=0;i_Fi elds<dt_Table.C olumns.Count;i_ Fields++)
{
s_FieldName = dt_Table.Column s[i_Fields].ColumnName; // May
not work > 0
tn_Node = new TreeNode();
tn_Node.Text = s_FieldName;
tn_Node.ImageIn dex = 7; // Column.ico
tn_Node.Selecte dImageIndex = 7; // Column.ico

ref_treeView.No des[i_DataSet].Nodes[i_DataSet].Nodes[i_DataSet].Nodes[i_Tabl
e].Nodes[i_DataSet].Nodes.Add(tn_N ode);
tn_Node = new TreeNode();
tn_Node.Text =
dt_Table.Column s[i_Fields].DataType.ToStr ing();
tn_Node.ImageIn dex = 10; // - NOTE12.ICO
tn_Node.Selecte dImageIndex = 10; // - NOTE12.ICO

ref_treeView.No des[i_DataSet].Nodes[i_DataSet].Nodes[i_DataSet].Nodes[i_Tabl
e].Nodes[i_DataSet].Nodes[i_Fields].Nodes.Add(tn_N ode);
} // for(int i_Fields=0;i_Fi elds<dt_Table.C olumns.Count;i_ Fields++)
} // for(int i_Table=0;i_Tab le<dset_MainFra me.Tables.Count ;i_Table++)
} // if (dset_MainFrame .Namespace != sa_treeView[0])
} // for (int i_DataSet=0;i_D ataSet<1;i_Data Set++)
// Open all the nodes
ref_treeView.Ex pandAll();
// Begin repainting the TreeView.
ref_treeView.En dUpdate();
if (ref_treeView == TreeViewDataSet )
{ // this is TreeView and DataTable specific !
if (dtable_MainFra me00 != null)
i_MainFrame00So rtCol = 0; // Rebuild ListView if Table is filled
} // if (treeViewDataSe t == TreeViewDataSet )
// Reset the cursor to the default for all controls.
Cursor.Current = Cursors.Default ;
//---------------
} // private void OnFillTreeViewD ataSet(ref ref_treeView, ref
dset_MainFrame, ref sa_treeView)
#endregion


"Mark Goldin" <ma********@com cast.net> wrote in message
news:Oj******** ******@TK2MSFTN GP11.phx.gbl...
Anybody can shart some working samples of using that control on Windows
form?

Thanks

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1828
by: dave | last post by:
What is the most effecient method to take data from a database table (sqlserver) to a vb.net treeview control. The database table looks like ID, Name, ParenetID 1 , test, <null> 2, test2, 1 3, test3, 2 The above would create a tree with 3 levels?
4
3452
by: meh | last post by:
I need to be able to persist a treeView to disk. I would like to save the node text, tag, image and selected image. I have done this using vb but I cant seem to translate from vb to vc#. Can ne1 point me to documentation or samples that might help??? Thanks in advance meh
0
3442
by: meh | last post by:
Still have not been able to convert this. More importently.....Is this sample going about it the right way??? tia meh Here is the vb code.........I keep looking at older vb.net projects to try and figure out how to teach myself C# based on my old vb code but it's been more difficult than I first thought. I'm finding that it would be better if didn't know any previous programming language.
2
4576
by: Trond Hoiberg | last post by:
Let say i have a bunch of files. Logfiles that is stored in subfolders. Folder1 --logfile1 --logfile2 --logfile3 Folder2 --logfile1 --logfile2 I want to display these files using data from the files in an TreeView
2
1309
by: Ernest Cook | last post by:
Does anyone have any real world experience using the .Net version of the treeview control? If so, Can you recommend any good documentation sources for learning more about it. i.e. Methods, etc. I have a few different samples projects and am looking for many more to help me understand everything I can about it. One of my current issues is in trying to add a node. I use the ADD method but under the .net version, you MUST add the node...
1
341
by: Larry Pits | last post by:
Hi All, I tried to add a treeview control onto my windows Form and I set the name of the treeview to otree1 and id to oletreeview1. In the test.aspx.vb, I want to add nodes to the tree and I am struck and confused. It's not the same a the old Visual Basic. Could someone help me out? TIA
1
18685
by: cjinsocal581 | last post by:
Hi all, I am struggling with the following: Environement: VB.NET 2005 TreeView Control SQL Database I need to be able to save a TreeView's nodes into a SQL database and then be able to call them from the Table back into the TreeView when the app starts up. (If the table is empty, then just exit the sub)
4
2315
by: Henry | last post by:
Does anybody have a real-world sample of buiding a treeview control using data from database tables? All the sample code I have found either builds the treeview manually or uses a file directory as the sample. I have trouble translating those samples to working with data coming from my database, so I am hoping that someone could show me a sample of code that builds a tree from say a dataset. Many controls you can bind to a datasource,...
0
1223
maliksleo
by: maliksleo | last post by:
hi i follow the following example http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/samples/ctrlref/navigation/TreeView/TreeView10.src for treeview to populate ondemand. Now i want to refresh the treeview text when some one renames a folder. I tried every thing and failed kindly give me a solution for that. I am designing a file management system. regards maliksleo
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10212
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10047
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.