![]() |
|
[.NET] [TUT] VB.net - Listview Search Function (MySql) [TUT] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] [TUT] VB.net - Listview Search Function (MySql) [TUT] (/showthread.php?tid=2440251) Pages: Pages
1
2
|
[TUT] VB.net - Listview Search Function (MySql) [TUT] - CPAManager - Apr 27, 2012 Listview Search Function (MySql) This tutorial shows you how to make a search function in your listview control with MySql. Demonstration on how it works: Download MySql.Data.dll Click here to download the *.dll file! Now add the dll to your references! So to start with create a new project and add the following controls:
Now make it look like this: [img]http://dl.dropbox.com/u/48593307/Billeder/tut1.png[/img] Add all the rows that you have in your database to the Combobox items. Note: On my project this search form is one for itself, and then it searches on another form, so you have to make this under the same form as where your listview is! Below 'Public Class (YourProjectName)' add the following code: PHP Code Add as many letters as your listview columns has. After this double click on the textbox, make sure that it handles TextChanged! Now add this code: PHP Code Edit the column1 and the others to your database column names! I hope that you learned something from this! 🤝 Take care! * - BlackLayer - Apr 27, 2012 Nice coding programmer, try raise new coding 😁 * - CPAManager - Apr 27, 2012 (Apr 27, 2012 05:00 AM)Visual Studio Wrote: Nice coding programmer, try raise new coding 😁 Thanks, Im recording a video now on how it works 🙂 * - Fake. - Apr 27, 2012 Sorry, but what is this line? Code Dim a, b, c, d, f, g, h, i, j, k* - CPAManager - Apr 27, 2012 (Apr 27, 2012 05:09 AM)Fake. Wrote: Sorry, but what is this line? It's the listview columns, lets say it have 10 columns, then you make 10 diffrent letters. 🙂 * - splendidshan - Aug 29, 2012 i have a problem with this '%" syntax in my code. what is the other way to run the program without using it. thank you. * - 0xDEAD10CC - Sep 1, 2012 There's much better ways for adding the SubItems... Use the ListViewItem constructor... ListViewItem(items As String()) Something like: Code ListView1.Items.Add(New ListViewItem(Enumerable.Range(1, 7).Select(Function(i) dr.Item(String.Format("column{0}", i)).ToString).ToArray))EDIT: (Apr 27, 2012 05:09 AM)Fake. Wrote: Sorry, but what is this line? Implicitly typed letter variables lol... Not good. * - Occulta - Sep 1, 2012 [img]http://cdn.memegenerator.net/instances/400x/26062287.jpg[/img] How I feel about the OP. * - Meerkat. - Sep 2, 2012 Why use MySQL for searching in a listview? Code Dim FoundItem as ListViewItem = ListView.FindItemWithText()* - 0xDEAD10CC - Sep 2, 2012 (Sep 2, 2012 12:02 AM)Mavamaarten~ Wrote: Why use MySQL for searching in a listview? You have to be able to add the items back after you clear them out from the search filtering. Unless you want to keep a variable with the full collection of ListViewItems as reference the whole time? * - picogenkaku - Sep 30, 2012 What's the use of the DataSet when it is not used in the code? :) * - mhaanne27 - Dec 29, 2012 thank you very much.. ^^ it's helpful.. * - System[X] - Dec 29, 2012 Why use MySql.Data.dll ? It would be a lot better to simply make a small php file to handle the data sent and received from the mysql database not to mention a lot more secure. Thanks * - vbdotnet09 - Dec 29, 2012 nice sharing brother :) keep it up :) this tutorial may help somebody :D * - CPAManager - Dec 29, 2012 (Dec 29, 2012 09:34 AM)System[X] Wrote: Why use MySql.Data.dll ? Made this along time ago, when i havent learned PHP yet. But now Im using PHP to connect to MySQL databases :) |