To all,
Below is the complete code that I'm using to build a treeview. As you will
see each node is populated by a category ....such as NA division, department,
then employee name. What I'm trying to do is to parse the node value that is
passed to my sub-routine called, "Information". The node that passes the
value to my information subroutine is from the subroutine called, "Employee",
which has a value in a comma delimeted information ....e.g. Michael de Vera,
1234. The value is passed when a user clicks on the appropriate node in my
tree view.
What I'm trying to do is to only get 1234. I can put a break in my code and
see that the node.value from the subroutine employee is actually passing the
correct value when the appropriate node is clicked for employee. I tried
several variations to figure why the right function code won't work but I'm
still unsuccessful. I have also tried using instr and mid functions but
those don't work either.
Thanks for any help.
Michael
Protected Sub tv_NA_Divisions_TreeNodePopulate(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.TreeNodeEventArgs) Handles
tv_NA_Divisions.TreeNodePopulate
If e.Node.ChildNodes.Count = 0 Then
Select Case e.Node.Depth
Case 0
PopulateNADivision(e.Node)
Case 1
PopulateNADepartment(e.Node)
Case 2
Employee(e.Node)
Case 3
Information(e.Node)
End Select
End If
End Sub
Sub PopulateNADivision(ByVal node As TreeNode)
Dim ds As DataSet
ds = DataAccess.Division_Description()
If ds.Tables.Count 0 Then
Dim row As DataRow
For Each row In ds.Tables(0).Rows
Dim newnode As TreeNode = New _
TreeNode(row("NA Divisions").ToString())
newnode.PopulateOnDemand = True
newnode.SelectAction = TreeNodeSelectAction.Expand
node.ChildNodes.Add(newnode)
Next
End If
End Sub
Sub PopulateNADepartment(ByVal node As TreeNode)
Dim ds As DataSet
ds = DataAccess.Department_Description(node.Value)
If ds.Tables.Count 0 Then
Dim row As DataRow
For Each row In ds.Tables(0).Rows
Dim newnode As TreeNode = New _
TreeNode(row("NA Departments").ToString())
newnode.PopulateOnDemand = True
newnode.SelectAction = TreeNodeSelectAction.Expand
node.ChildNodes.Add(newnode)
Next
End If
End Sub
Sub Employee(ByVal node As TreeNode)
Dim ds As DataSet
ds = DataAccess.Employee_by_Department(node.Value)
If ds.Tables.Count 0 Then
Dim row As DataRow
For Each row In ds.Tables(0).Rows
Dim newnode As TreeNode = New _
TreeNode(row("Employee Name").ToString() & "," & " " &
row("EXT").ToString())
newnode.PopulateOnDemand = True
newnode.SelectAction = TreeNodeSelectAction.Expand
node.ChildNodes.Add(newnode)
Next
End If
End Sub
Sub Information(ByVal node As TreeNode)
Dim account As String
account = "abcdefghijk"
Dim TESTing As String
TESTing = Right("abcdefghijk", 4)
'Dim GID_String As String = Microsoft.VisualBasic.Right(node.Value, 4)
End Sub
End Class
"Linda Liu [MSFT]" wrote:
Hi Michael,
I performed a test on Microsoft.VisualBasic.Right function, but didn't
reproduce the problem. The function always returns the correct result in my
test.
Perhaps the variable 'account' has been changed before you call
Microsoft.VisualBasic.Right function.
If the problem still exists, you may show us your complete related code or
send me a sample project that could just reproduce the problem. To get my
actual email address, remove 'online' from my displayed email address.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.