How-to with Databases?
How-to with Databases?
How-to with Databases?
How-to with Databases?
How-to with Databases?
How-to with Databases? How-to with Databases? How-to with Databases? How-to with Databases? How-to with Databases? How-to with Databases? How-to with Databases? How-to with Databases?
How-to with Databases? How-to with Databases?
How-to with Databases?
Go Back  Xtreme Visual Basic Talk > > > How-to with Databases?


Reply
 
Thread Tools Display Modes
  #21  
Old 11-05-2006, 06:53 AM
tominko tominko is offline
Newcomer
 
Join Date: Oct 2006
Posts: 24
Default


Quote:
Originally Posted by MikeJ
Visual Basic.NET Books
We have three very good recommendations in this thread for ADO.NET books.


Option Strict On forces data types to be converted, rather than the usual lazy method that most programmers take and rely on implicit type conversion. It also helps keep precision by forcing you to be so precise. See http://msdn.microsoft.com/library/de...tionStrict.asp

You really should not use Legacy functions in .net, in the case of Mid$, you should use the Substring method of the string object. Also, in regards to the treeview, it is easier than ever to check which nodes are parents/children, etc. You just need to iterate through each node to see. Check out the TreeView control in MSDN as well.

option strict on if cool ;-) i don't have problem to declare all data types, maybe it can be faster then.

i know substring from perl (but there i using regular expressions) i'll try to use it in vb - it is faster than mid$ ?

i don't understad what you mean with this treeview :-( i think that my way is not so bad ;-)

Code:
Sub TreeReload() Dim NodX As TreeNode MainForm.ShopTree.Nodes.Clear() NodX = MainForm.ShopTree.Nodes.Add("SH_0", "Main Items", 0, 0) LoadTreeNode(0, NodX) End Sub Private Sub LoadTreeNode(ByVal ID As Integer, ByVal Node As TreeNode) Dim RS As New ADODB.Recordset RS.Open("SELECT * FROM Categories WHERE Root_ID=" & ID.ToString, DB) Do Until RS.EOF FindNodeByKey(Node, "SH_" & RS.Fields("Root_ID").Value).Nodes.Add("SH_" & RS.Fields("ID").Value, RS.Fields("Name").Value, 1, 1) LoadTreeNode(RS.Fields("ID").Value, Node) RS.MoveNext() Loop RS.Close() End Sub Public Function FindNodeByKey(ByVal Node As TreeNode, ByVal Key As String) As TreeNode Dim MyNode As TreeNode FindNodeByKey = Nothing Dim NC As Integer If Node.Name = Key Then FindNodeByKey = Node Exit Function End If If Node.Nodes.ContainsKey(Key) = True Then FindNodeByKey = Node.Nodes(Key) Exit Function Else For NC = 0 To Node.Nodes.Count - 1 MyNode = FindNodeByKey(Node.Nodes(NC), Key) If MyNode Is Nothing = False Then FindNodeByKey = MyNode Exit Function End If Next End If End Function

if you know about better way to do it give code :-)
Reply With Quote
  #22  
Old 11-05-2006, 12:32 PM
MikeJ's Avatar
MikeJHow-to with Databases? MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

Substring would be faster than Mid$ in .NET, I believe. And that's a good use of a recursive function, so disregard what I said about doing things better. As long as the TreeView doesn't have a large quantity of nested nodes and subnodes, it should be just as fast as a linear search function.
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #23  
Old 11-05-2006, 01:19 PM
tominko tominko is offline
Newcomer
 
Join Date: Oct 2006
Posts: 24
Default

Quote:
Originally Posted by MikeJ
Substring would be faster than Mid$ in .NET, I believe. And that's a good use of a recursive function, so disregard what I said about doing things better. As long as the TreeView doesn't have a large quantity of nested nodes and subnodes, it should be just as fast as a linear search function.
my vb.net don't know substring
...mid$ is ok for now - i'm just looking for differences between vb6 and vb.net and i want to know if i can make application in vb.net and i think yes
Reply With Quote
  #24  
Old 11-05-2006, 02:01 PM
MikeJ's Avatar
MikeJHow-to with Databases? MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

It doesn't know the Substring method? Did you remove the reference from System? What do you mean "don't know substring"?
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #25  
Old 11-05-2006, 02:07 PM
tominko tominko is offline
Newcomer
 
Join Date: Oct 2006
Posts: 24
Default

Quote:
Originally Posted by MikeJ
It doesn't know the Substring method? Did you remove the reference from System? What do you mean "don't know substring"?
if i write substr and press ctrl+space it's not in list and if i write subsrting then is not shown as method or command... i don't delete nothong from references

...another question is possible to 'define' somehow regexp functionality like in perl?

Code:
dim AA as string
AA="kjlkjlkj"
AA=~s/lk/ooooo/
Reply With Quote
  #26  
Old 11-05-2006, 02:36 PM
MikeJ's Avatar
MikeJHow-to with Databases? MikeJ is offline
Retread

Retired Moderator
* Expert *
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 6,747
Default

Did you check out MSDN? If you did, you would have seen that Substring is a method of the String object:
Code:
Dim s As String = "abcdefg" MessageBox.Show(s.Substring(2,3))

Again, see MSDN:
http://msdn.microsoft.com/library/de...xpressions.asp
__________________
{ Lex Fori } { Locus Classicus } { Rutilus Scrinium }
Osculare pultem meam!
Reply With Quote
  #27  
Old 11-05-2006, 04:43 PM
tominko tominko is offline
Newcomer
 
Join Date: Oct 2006
Posts: 24
Default

Quote:
Originally Posted by MikeJ
Did you check out MSDN? If you did, you would have seen that Substring is a method of the String object:
Code:
Dim s As String = "abcdefg" MessageBox.Show(s.Substring(2,3))

Again, see MSDN:
http://msdn.microsoft.com/library/de...xpressions.asp
not bad thnx
Reply With Quote
  #28  
Old 11-06-2006, 03:33 AM
tominko tominko is offline
Newcomer
 
Join Date: Oct 2006
Posts: 24
Default

Quote:
Originally Posted by MikeJ
Did you check out MSDN? If you did, you would have seen that Substring is a method of the String object:
Code:
Dim s As String = "abcdefg" MessageBox.Show(s.Substring(2,3))

Again, see MSDN:
http://msdn.microsoft.com/library/de...xpressions.asp
...i know expressions in vb but it's too complicated (everything in vb.net is complicated )
Reply With Quote
  #29  
Old 11-06-2006, 09:21 AM
reboot's Avatar
rebootHow-to with Databases? reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,614
Default

You have to forget VB6 and look at vb.Net as a new language to be learned. Of course it's complicated; programming is hard.
__________________
~ Quod non mortiferum, fortiorem me facit ~

Avatar by lebb
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
How-to with Databases?
How-to with Databases?
How-to with Databases? How-to with Databases?
How-to with Databases?
How-to with Databases?
How-to with Databases? How-to with Databases? How-to with Databases? How-to with Databases? How-to with Databases? How-to with Databases? How-to with Databases?
How-to with Databases?
How-to with Databases?
 
How-to with Databases?
How-to with Databases?
 
-->