tashiduks
Member
- Joined
- Apr 19, 2010
- Messages
- 22
- Programming Experience
- Beginner
Hi Everyone,
I have following code which populates the data from database to treeview node.
I have a form with following form controls which should fill the value of selected node to controls:
gpsGrade.text
gpsIntGrade.text
gpsMinPay.text
gpsIncrement.text
gpsMaxPay.text
gpsGISGroup.text
gpsGISCont.text
gpsSWSCont.text
gpsSWSPercentageYN.checkstate
gpsRetirementAge.text
I am using VB languagqe in VB.NET 2010 with SQL SERVER 2008. So can anyone tell me how fill the selected node value to the respective form controls when user selects the treenode.
I have following code which populates the data from database to treeview node.
VB.NET:
Private Sub FormLoad()
Dim cnTest As New SqlClient.SqlConnection("DATA SOURCE=tashi\dbtestsrv;USER ID=sa;PASSWORD=s@1234;INITIAL CATALOG=BDFCLHR;")
'Dim daCountry As New SqlClient.SqlDataAdapter("SELECT CsCountryCode,CsCountryName from hrCountrySetup", cnTest)
Dim strSelectQry As String
strSelectQry = "SELECT [gpsGrade] ,[gpsIntGrade] ,[gpsMinPay] ,[gpsIncrement] ,[gpsMaxPay] ,[gpsGISGroup] ,[gpsGISCont] ,[gpsSWSCont] ,[gpsSWSPercentageYN] ,[gpsRetirementAge] FROM [BDFCLHR].[dbo].[hrGradePayScale]"
Dim daCountry As New SqlClient.SqlDataAdapter(strSelectQry, cnTest)
dsTest = New DataSet()
cnTest.Open()
daCountry.Fill(dsTest, "dtCountry")
cnTest.Close()
TreeView1.Nodes.Clear()
'Dim parentrow As DataRow
'Dim parenttable As DataTable
Dim parentnode As New TreeNode
Dim childNode As TreeNode
parentnode = New TreeNode("Grade")
TreeView1.Nodes.Add(parentnode)
ParentTable = dsTest.Tables("dtCountry")
For Each Me.ParentROW In ParentTable.Rows
childNode = New TreeNode(ParentROW.Item(1) & " - " & ParentROW.Item(2) & " - " & ParentROW.Item(3) & " - " & ParentROW.Item(4))
parentnode.Nodes.Add(childNode)
'TextBox1.Text = ParentROW.Item(0)
'TextBox2.Text = ParentROW.Item(1)
Next ParentROW
TextBox1.Enabled = False
TextBox2.Enabled = False
End Sub
I have a form with following form controls which should fill the value of selected node to controls:
gpsGrade.text
gpsIntGrade.text
gpsMinPay.text
gpsIncrement.text
gpsMaxPay.text
gpsGISGroup.text
gpsGISCont.text
gpsSWSCont.text
gpsSWSPercentageYN.checkstate
gpsRetirementAge.text
I am using VB languagqe in VB.NET 2010 with SQL SERVER 2008. So can anyone tell me how fill the selected node value to the respective form controls when user selects the treenode.