|
-
Mar 22nd, 2019, 02:35 AM
#1
Thread Starter
Lively Member
Why Not Accept TreeView SelectedNode based onTextBox.Text ?
wtihs this code I set Focus to TreeView Node.
Code:
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
'Expand(TextBox3.Text) '("C:\7143\Baltek")
gotNode = False
For Each n As TreeNode In Me.TreeView1.Nodes
If Not gotNode Then
selectTreeNode(n, TextBox3.Text) ' "C:\7143\Baltek")
End If
Next
End Sub
When I try to set focus TreeViewNode based on TextBox.Text (with dont care uppercase, lowercase) then no result.
For Excample Node Tag is "C:\7143\Baltek")
if I enter "C:\7143\baltek") or "C:\7143\BalteK") no result, because of Upper LowerCase typing
how can I adjust to find not with any type textbox.text.
-
Mar 22nd, 2019, 02:44 AM
#2
Re: Why Not Accept TreeView SelectedNode based onTextBox.Text ?
Presumably you are performing a String comparison in that 'selectTreeNode' method so you need to make that comparison case-insensitive. You don't need us to tell you how to do that because you can find out in a matter of seconds by searching the web with the appropriate keywords, e.g. "vb.net case insensitive comparison".
-
Mar 22nd, 2019, 09:37 AM
#3
Thread Starter
Lively Member
Re: Why Not Accept TreeView SelectedNode based onTextBox.Text ?
 Originally Posted by jmcilhinney
Presumably you are performing a String comparison in that 'selectTreeNode' method so you need to make that comparison case-insensitive. You don't need us to tell you how to do that because you can find out in a matter of seconds by searching the web with the appropriate keywords, e.g. "vb.net case insensitive comparison".
thanks for edvice but I couldnt find a solution. but same problem here
Code:
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
For Each n As TreeNode In Me.TreeView1.Nodes(0).Nodes
If n.Text = "Users" Then
TreeView1.SelectedNode = n
TreeView1.Select()
TreeView1.SelectedNode.Expand()
End If
Next
End Sub
When Type "Users" 'With Capital "U"
TreeView.SelectedNode is Focus On "C:\Users"
But When I type "users" with "u"
this time result is nothing.
is the problem about TreeView or about the Code ?
-
Mar 22nd, 2019, 09:50 AM
#4
Re: Why Not Accept TreeView SelectedNode based onTextBox.Text ?
As implied earlier, it is about the code:
 Originally Posted by Nicomendox
Code:
If n.Text = "Users" Then
That is a case sensitive comparison (ie: only "Users" will match, "users" or "USERS" etc wont), and you want a case insensitive comparison.
Following the advice about a web search (using the text jmcilhinney provided) gives many relevant results, including this one:
https://docs.microsoft.com/en-us/dot...ypes/comparing
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|