Hi,
I am a self taught VBA programmer, and I'm trying to learn VB2005 Express
(The price was right).
I like the look of the treeview control, and I'd like to use it as a menu
system for my users, the options they are allowed to see are all different
and specified in a MSACCESS table.
Can I populate a Treeview directly from my MSAccess table ?
I can then of course filter the table to only show that users options.
As I am new to this I could do with some babysitting.
Thanks for any help
Paul 5 5781
Hi,
You can not bind a treeview to a datasource. Here are some links on
how to fill a treeview from a database. http://msdn.microsoft.com/library/de...cntrlsamp3.asp http://www.vb-tips.com/default.aspx?...f-04dfd3b31b2b http://support.microsoft.com/default...b;en-us;308063
Ken
-------------------
"Paul" <te**@tester.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, I am a self taught VBA programmer, and I'm trying to learn VB2005 Express (The price was right). I like the look of the treeview control, and I'd like to use it as a menu system for my users, the options they are allowed to see are all different and specified in a MSACCESS table.
Can I populate a Treeview directly from my MSAccess table ?
I can then of course filter the table to only show that users options.
As I am new to this I could do with some babysitting.
Thanks for any help
Paul
Paul,
You can build an Treeview for a AccessTable, however as a lot of people are
you probably trying to build something as your own Accesssystem with this.
Be aware that you alone can never get that functionality (and your users
expect that) as that MS access with that big Microsoft organisation has.
Just my thought,
Cor
Hi Ken,
Thanks for your response.
I checked out the code on your website and it worked great, but I need to
make my application fill the treeview from my access table.
I created and populated table with the 3 columns (ParentID,DetailId and
Description) , and created a datasource to it, then I added a datagrid to my
form from the database, so a binding source etc where all automatically
created.
Can you show me how I would now amend the code from http://www.vb-tips.com/default.aspx?...f-04dfd3b31b2b
to fill the treeview from my table rather than from the (if I understand it
correctly) "Virtual" table that your code creates ?
If it helps, I called my table TBL_MENU.
Thanks again for your help
Paul
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OR**************@TK2MSFTNGP15.phx.gbl... Hi,
You can not bind a treeview to a datasource. Here are some links on how to fill a treeview from a database.
http://msdn.microsoft.com/library/de...cntrlsamp3.asp
http://www.vb-tips.com/default.aspx?...f-04dfd3b31b2b
http://support.microsoft.com/default...b;en-us;308063
Ken ------------------- "Paul" <te**@tester.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, I am a self taught VBA programmer, and I'm trying to learn VB2005 Express (The price was right). I like the look of the treeview control, and I'd like to use it as a menu system for my users, the options they are allowed to see are all different and specified in a MSACCESS table.
Can I populate a Treeview directly from my MSAccess table ?
I can then of course filter the table to only show that users options.
As I am new to this I could do with some babysitting.
Thanks for any help
Paul
Hi,
One possible solution. I used a datareader to load the treeview. I
loaded the unitprice and converted it to a decimal to format the price. You
could have used dr.getdecimal to get the price but you need to specify the
column number instead of name.
Imports System.Data.OleDb
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim conn As OleDbConnection
Dim strConn As String
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"
strConn &= "Data Source = c:\Northwind.mdb;"
conn = New OleDbConnection(strConn)
cmd = New OleDbCommand("Select * from Products", conn)
conn.Open()
dr = cmd.ExecuteReader
Do While dr.Read
Dim nd As New TreeNode(dr.Item("ProductName").ToString)
nd.Nodes.Add(String.Format("Price {0}",
Convert.ToDecimal(dr.Item("UnitPrice")).ToString(" c")))
nd.Nodes.Add(String.Format("Units In Stock {0}",
dr.Item("UnitsInStock").ToString))
nd.Nodes.Add(String.Format("Units On Order {0}",
dr.Item("UnitsOnOrder").ToString))
TreeView1.Nodes.Add(nd)
Loop
conn.Close()
End Sub
End Class
Ken
-----------------
"Paul" <te**@tester.com> wrote in message
news:O9**************@TK2MSFTNGP10.phx.gbl... Hi Ken, Thanks for your response. I checked out the code on your website and it worked great, but I need to make my application fill the treeview from my access table.
I created and populated table with the 3 columns (ParentID,DetailId and Description) , and created a datasource to it, then I added a datagrid to my form from the database, so a binding source etc where all automatically created.
Can you show me how I would now amend the code from http://www.vb-tips.com/default.aspx?...f-04dfd3b31b2b to fill the treeview from my table rather than from the (if I understand it correctly) "Virtual" table that your code creates ?
If it helps, I called my table TBL_MENU.
Thanks again for your help
Paul
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message news:OR**************@TK2MSFTNGP15.phx.gbl... Hi,
You can not bind a treeview to a datasource. Here are some links on how to fill a treeview from a database.
http://msdn.microsoft.com/library/de...cntrlsamp3.asp
http://www.vb-tips.com/default.aspx?...f-04dfd3b31b2b
http://support.microsoft.com/default...b;en-us;308063
Ken ------------------- "Paul" <te**@tester.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, I am a self taught VBA programmer, and I'm trying to learn VB2005 Express (The price was right). I like the look of the treeview control, and I'd like to use it as a menu system for my users, the options they are allowed to see are all different and specified in a MSACCESS table.
Can I populate a Treeview directly from my MSAccess table ?
I can then of course filter the table to only show that users options.
As I am new to this I could do with some babysitting.
Thanks for any help
Paul
Ken,
You are my new best friend.
This works and its fantastic, Just as I was about to give in on VB and stick
with MsAccess VBA you showed me the way.
Of course this means I'll be progressing my project and asking lots more
questions !
Thanks again
Paul
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... Hi,
One possible solution. I used a datareader to load the treeview. I loaded the unitprice and converted it to a decimal to format the price. You could have used dr.getdecimal to get the price but you need to specify the column number instead of name.
Imports System.Data.OleDb
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim conn As OleDbConnection Dim strConn As String Dim cmd As OleDbCommand Dim dr As OleDbDataReader
strConn = "Provider = Microsoft.Jet.OLEDB.4.0;" strConn &= "Data Source = c:\Northwind.mdb;"
conn = New OleDbConnection(strConn) cmd = New OleDbCommand("Select * from Products", conn)
conn.Open() dr = cmd.ExecuteReader Do While dr.Read Dim nd As New TreeNode(dr.Item("ProductName").ToString) nd.Nodes.Add(String.Format("Price {0}", Convert.ToDecimal(dr.Item("UnitPrice")).ToString(" c"))) nd.Nodes.Add(String.Format("Units In Stock {0}", dr.Item("UnitsInStock").ToString)) nd.Nodes.Add(String.Format("Units On Order {0}", dr.Item("UnitsOnOrder").ToString)) TreeView1.Nodes.Add(nd) Loop conn.Close() End Sub End Class
Ken ----------------- "Paul" <te**@tester.com> wrote in message news:O9**************@TK2MSFTNGP10.phx.gbl... Hi Ken, Thanks for your response. I checked out the code on your website and it worked great, but I need to make my application fill the treeview from my access table.
I created and populated table with the 3 columns (ParentID,DetailId and Description) , and created a datasource to it, then I added a datagrid to my form from the database, so a binding source etc where all automatically created.
Can you show me how I would now amend the code from http://www.vb-tips.com/default.aspx?...f-04dfd3b31b2b to fill the treeview from my table rather than from the (if I understand it correctly) "Virtual" table that your code creates ?
If it helps, I called my table TBL_MENU.
Thanks again for your help
Paul
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message news:OR**************@TK2MSFTNGP15.phx.gbl... Hi,
You can not bind a treeview to a datasource. Here are some links on how to fill a treeview from a database.
http://msdn.microsoft.com/library/de...cntrlsamp3.asp
http://www.vb-tips.com/default.aspx?...f-04dfd3b31b2b
http://support.microsoft.com/default...b;en-us;308063
Ken ------------------- "Paul" <te**@tester.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... Hi, I am a self taught VBA programmer, and I'm trying to learn VB2005 Express (The price was right). I like the look of the treeview control, and I'd like to use it as a menu system for my users, the options they are allowed to see are all different and specified in a MSACCESS table.
Can I populate a Treeview directly from my MSAccess table ?
I can then of course filter the table to only show that users options.
As I am new to this I could do with some babysitting.
Thanks for any help
Paul
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Scott James |
last post by:
I've found several useful example showing how to populate a treeview
control from an XML file. I've also found a couple examples showing
how to serialize a treeview control to an XML file using...
|
by: lauren quantrell |
last post by:
So many postings on not to use the treeview control, but nothing
recently. Is it safe to swim there yet with Access 2000-Access 2003?
|
by: Sonia Igla |
last post by:
Hi. I need to perform DBLCLK on TreeView Node.
I try the following:
private static extern int SendMessage(IntPtr hWnd, uint msg, UInt32 wParam,
UInt32 lParam);
private const UInt32...
|
by: http://www.visual-basic-data-mining.net/forum |
last post by:
Hello,
I am working on Treeview control. I want that, user create tree according to
his requirement, can add topic under any node.
Then just click update and that treeview data to be stored in...
|
by: Chris |
last post by:
I have treeview control I want to populate progamatically. It will sit in
the edit and insert template of a formview. If I want to reference it with
Formview1.FindControl("treeview1") and populate...
|
by: drop |
last post by:
Hi,
I'm currently working with the Treeview control in ASP .Net 2.0. The
tree is filled dynamically based on data contained in a MySQL Database.
Here is the exact behavior I want :
1 - User...
|
by: Christof Nordiek |
last post by:
Hi all,
in my WinForm-Application i have a strange problem with the TreeView
Control.
As you can see in the samplecode below, i fill the TreeView by adding some
nodes with sub nodes. (The...
|
by: benjamins |
last post by:
Hi,
I'm trying to populate a treeview control in msaccess with chinese characters.
I'm able to have these characters appear correctly in listviews etc by allocating the data directly via the...
|
by: balurajeev84 |
last post by:
Hi,
I am trying to convert a VB.net code to C# .
it is to bind a treeview from a collection. but not finding a Collection which stores treenodes as object.
Cant use hashtable since it...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
|
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...
| |